← Questions
Decode and expand supported card identifiers
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A payment card reports the applications it supports as one encoded string: each entry is a two-digit length followed by that many characters, and a single 0 ends the string. A terminal has its own ordered list of supported identifiers.
- Decode the string into its entries, in order.
- Keep only the entries that exactly match an identifier the terminal supports.
- Treat an entry that is not an exact match as a prefix and expand it to every supported identifier that starts with it, in the terminal's order. Never output an identifier twice, and if an identifier appears later as an exact entry, place it there instead of under the earlier prefix.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
