FastPrepNth Fixed-Format License Plate
Problems/Nth Fixed-Format License Plate

Nth Fixed-Format License Plate

Google logoGoogle● MediumNEW GRADONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source directly provides a fixed license format with uppercase A-Z letters followed by 0-9 digits, example AAA000, lexicographic ordering, and an Nth-plate objective. Variable letter/digit counts, one-indexing, examples, and bounds are practice scaffolding. This identity is distinct from the existing Google Nth License Plate sequence that shifts character classes across six five-character groups. The judged core matches the visible source at about 91%.

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) → String

Examples

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 problems

  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String nthFixedFormatLicensePlate(int letterCount, int digitCount, long n) {
        // write your code here
    }
}
Checking account…