Question bank › Sorting
Dsa Sorting Easy

Event Date Sorter

You are organizing a series of events that have specific dates. Your task is to sort the events by their dates in ascending order. The input will consist of an integer N followed by N lines, each containing an event name and a date in the format 'YYYY-MM-DD'. The output should display the events sorted chronologically. In case of events on the same date, sort them alphabetically by their names. Input Format: N Event1 YYYY-MM-DD Event2 YYYY-MM-DD ... EventN YYYY-MM-DD Output Format: Event1 YYYY-MM-DD Event2 YYYY-MM-DD ... EventN YYYY-MM-DD Example: Input: 3 Conference 2023-05-20 Workshop 2023-01-15 Meeting 2023-05-20 Output: Workshop 2023-01-15 Conference 2023-05-20 Meeting 2023-05-20

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