Dsa
Sorting
Easy
Tournament Standings
Rank players in a tournament based on: 1. Highest number of wins. 2. Lowest number of losses (if wins are tied). 3. Player name alphabetical, case-insensitive (if wins and losses are tied). Output the names in ranked order.
Input Format:
Line 1: Integer N.
Next N lines: 'Name Wins Losses'
Output Format:
Sorted player names, one per line.
Example:
Input:
3
Alice 10 2
bob 10 2
Charlie 12 1
Output:
Charlie
Alice
bob
Key concepts
tie-breakingstring normalization
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