Maximum Vehicle Registrations Problem

Bob, the mayor of a state, seeks to determine the maximum number of vehicles that can be uniquely registered. Each vehicle's registration number is structured as follows: ST 01 AB 1234. The registration number comprises four sections, with specific rules governing each part.

Explanation:

The registration is formed by:

  1. A two-letter prefix common across the state.
  2. A two-digit district identifier, potentially with leading zeros.
  3. A series of two letters selected from specified ranges.
  4. A sequence of four digits, fixed at four digits even if leading zeros are present.

Your task is to determine the maximum possible number of unique vehicle registrations given the number of districts, the range of series letters, and the range of digits.

Input:

The first line contains integer 'T', the number of test cases.
For each test case:
- The first line has 'districtCount', the number of districts.
- The second line has four space-separated characters representing the letter ranges for series: 'ALPHA1', 'ALPHA2', 'ALPHA3', 'ALPHA4'.
- The third line contains four space-separated integers denoting the digit ranges: 'DIG1', 'DIG2', 'DIG3', 'DIG4'.

Output:

For each test case, output a single integer indicating the maximum number of unique vehicles that can be registered.

Example:

Input:
2
5
A D K N
2 3 4 5
3
P T L R
6 7 8 9
Output:
80000
120000

Constraints:

  • 1 <= T <= 10^4
  • 1 <= Number of districts < 10^2
  • A <= Range of alphabets <= Z
  • 0 <= Range of digits <= 9
  • ALPHA1 <= ALPHA2 and ALPHA3 <= ALPHA4

Note that the task requires computing the result only and does not require printing, it is handled separately.

AnswerBot
4d

Calculate the maximum number of unique vehicle registrations based on given constraints.

  • Parse input for number of test cases, district count, letter ranges, and digit ranges.

  • Calculate the total number...read more

Help your peers!
Add answer anonymously...
TCS Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter