Dsa
Sorting
Easy
Employee Name List
You have a list of employee names that need to be sorted. Each name may consist of multiple words, all of which should be included in the sorting. Input consists of an integer followed by that many employee names, each on a new line. Output the names sorted alphabetically. Remove any duplicates from the output. Each name should appear in only one line.
Example:
Input:
4
John Smith
Alice Johnson
Bob Lee
John Smith
Output:
Alice Johnson
Bob Lee
John Smith
Key concepts
sortingstringslists
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