Question bank › Sorting
Dsa Sorting Easy

Event Date Sorting

You are organizing a series of events and need to sort them by their dates. Each event has a name and a date in the format "DD-MM-YYYY". Write a program to sort the events first by date (earliest first) and by name if dates are identical. Input: - The first line contains an integer k (1 ≤ k ≤ 100), the number of events. - The next k lines each contain an event name followed by its date. Output: - Print the sorted list of events in the format: "EventName Date". Example: Input: 3 Workshop 15-01-2022 Conference 14-01-2022 Seminar 15-01-2022 Output: Conference 14-01-2022 Workshop 15-01-2022 Seminar 15-01-2022

Key concepts

sortingdatestuples

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.