Imagine an office which issues license plates in the following format and order:
00000, 00001, 00002, ..., 99999,
A0000, A0001, ..., A9999, B0000, ..., Z9999,
AA000, ..., ZZ999,
AAA00, ..., ZZZ99,
AAAA0, ..., ZZZZ9,
AAAAA, ..., ZZZZZ
That is, the sequence is the concatenation of six ranges, where:
- license plates in the first range have 5 digits,
- license plates in the second range have 1 letter followed by 4 digits,
- license plates in the third range have 2 letters followed by 3 digits,
- license plates in the fourth range have 3 letters followed by 2 digits,
- license plates in the fifth range have 4 letters followed by 1 digit, and
- license plates in the sixth range have 5 letters (and 0 digits).
Note that this is not just base-36 conversion. For example, 12CD5 is not a valid license plate. Each range has a fixed number of letters followed by a fixed number of digits.
Write a function that returns the nth license plate in the sequence, given n as the input. n starts from 0, so the function should return:
f(0) -> 00000f(1) -> 00001f(100000) -> A0000f(?) -> ZZZZZ
The key idea is to treat the license plates as six consecutive blocks with fixed patterns, then map n into the correct block and convert the offset into a letter part and a digit part. The letter suffix is a base-26 sequence, while the digit suffix is a fixed-width decimal number with leading zeros. This is a simple but very interview-friendly problem that tests indexing, number-system conversion, and careful formatting rather than general base-36 logic.