Dsa
Sorting
Medium
Employee Rank Sort
You are given a list of employees where each employee has an id, name, and score. Your goal is to sort the employees by their score in descending order and by name alphabetically in case of a tie.
Input:
- The first line contains an integer n (1 <= n <= 1000).
- The next n lines contain employee_id (a string), name (a string), and score (an integer).
Output:
- Print each employee in the sorted order in the format 'employee_id name score'.
Example:
Input:
3
E001 Alice 92
E002 Bob 85
E003 Charlie 92
Output:
E001 Alice 92
E003 Charlie 92
E002 Bob 85
Key concepts
sortingrankingcomparison
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