Dsa
Sorting
Easy
Sort Event Schedules
You are organizing several events, each defined by a name and a date in YYYY-MM-DD format. Write a program that sorts the events by date in ascending order, and if two events fall on the same date, sorts them by their names in alphabetical order. The input will be multiple lines of event name followed by date. Output the sorted event names, one per line. Example input: "Meeting 2023-10-05\nConference 2023-09-20\nWebinar 2023-10-05" results in: "Conference\nMeeting\nWebinar".
Key concepts
sortingdatesstrings
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