Dsa
Queue
Medium
Train Platform Scheduler
You are managing a train station with multiple platforms. Each train arrives and departs at specific times. Your task is to determine the order of trains on the platforms and when each train gets to leave.
Input Format:
- The first line contains integer n (number of trains).
- The next n lines each contain two integers: arrival time and departure time.
Output Format:
- Output the order of trains as they depart.
Example Input:
3
1 4
2 3
3 5
Example Output:
1
2
3
Key concepts
queueeventstiming
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