Dsa
Sorting
Easy
Warehouse Aisle Codes
A warehouse uses location codes in the format 'Zone-Aisle-Shelf' (e.g., 'A-12-B'). You must sort these codes. Zones are single letters (A-Z). Aisles are numbers. Shelves are single letters (A-Z). Sorting rules: 1. Alphabetical by Zone. 2. Numerical by Aisle (treat '2' as smaller than '10'). 3. Alphabetical by Shelf.
Input Format:
First line: Integer N.
Next N lines: A single location code string.
Output Format:
The sorted location codes, one per line.
Example:
Input:
3
B-10-A
B-2-Z
A-1-A
Output:
A-1-A
B-2-Z
B-10-A
Key concepts
string parsingmulti-key sorting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now