Nth Fixed-Format License Plate
Updated
Problem statement
A license plate contains exactly letterCount uppercase English letters followed by exactly digitCount decimal digits. For example, three letters and three digits produce plates such as AAA000.
Sort every valid plate lexicographically. Given a one-indexed position n, return the plate at that position.
Function
nthFixedFormatLicensePlate(letterCount: int, digitCount: int, n: long) → StringExamples
Example 1
letterCount = 3digitCount = 3n = 1return = "AAA000"AAA000 is the first plate.
Example 2
letterCount = 3digitCount = 3n = 1001return = "AAB000"AAA000 through AAA999 occupy the first 1000 positions, so AAB000 is next.
Example 3
letterCount = 1digitCount = 2n = 2600return = "Z99"This is the final plate for one letter and two digits.
Constraints
1 <= letterCount, digitCount <= 6.1 <= n <= 26^letterCount * 10^digitCount.
More Google Onsite Interview questions
- Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
- Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
- Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
- Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
- Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
- Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Calculate a Token-List ExpressionCollege Vine · ONSITE INTERVIEW
- Iterate Canonical IPv6 AddressesOpenAI · ONSITE INTERVIEWOpenAI interview questions
- Parse a Signed Integer in Any BaseMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Bit at an Index After Repeated Binary ExpansionAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Text Embedding and Vector SearchNike, Inc. · PHONE SCREEN · ONSITE INTERVIEWNike, Inc. interview questions
- Fraction to Recurring DecimalGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Rank Bipedal Dinosaurs by SpeedMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Every Result of Grouping an ExpressionC3.ai · ONSITE INTERVIEWC3.ai interview questions
- Largest Minus Smallest Value of a Parenthesized ExpressionNutanix · ONSITE INTERVIEWNutanix interview questions
- String to Integer with ClampingAMD · ONSITE INTERVIEWAMD interview questions