Question bank › Queue
Dsa Queue Easy

Train Scheduling

In a train scheduling system, trains arrive and depart at specific intervals. Given a list of arrival and departure times, determine the order in which the trains will leave the station based on their scheduled departure times. The list is limited to 100 trains. Input Format: - An integer N (1 ≤ N ≤ 100) that specifies the number of trains. - For each train, two integers A (arrival time) and D (departure time) (1 ≤ A < D ≤ 1000). Output Format: - Output the departure times in ascending order, separated by spaces. Example: Input: 3 10 20 5 15 15 25 Output: 20 25

Key concepts

queuesorting

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.