Dsa
Sorting
Easy
Sort Project Tasks
You are managing a project with various tasks, each with a name and its estimated duration in hours. Write a program to sort these tasks first by duration in ascending order, and for tasks with equal duration, alphabetically by task name. The task list is provided line by line via standard input. Output the sorted task names one per line. Example input: "Task A 5\nTask C 3\nTask B 5" would result in: "Task C\nTask A\nTask B".
Key concepts
sortingtupleslists
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