Dsa
Sorting
Warm-up
Classroom Height Rank
A teacher wants to arrange students for a photo. Students must be sorted primarily by height (tallest to shortest). If students have the exact same height, they should be sorted by their age (youngest to oldest). If they are still tied, sort them alphabetically by name.
Input: First line N. Next N lines: Name Height(cm) Age.
Output: The sorted names, one per line.
Example Input:
3
Alice 150 10
Bob 160 11
Charlie 150 9
Example Output:
Bob
Charlie
Alice
Key concepts
sortingmapping
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