Dsa
Queue
Medium
Train Station Queue Management
You are tasked with managing the flow of passengers at a train station. Passengers arrive over time and need to be processed based on their arrival times. Each passenger has to check-in and board the train.
Input Format:
- The first line contains an integer N (1 <= N <= 1000), the number of passengers.
- Each of the next N lines contains three integers: arrival time A (in minutes), check-in time C (the time it takes to check-in), and boarding time B (the time it takes to board).
Output Format:
- Print the final order of passengers (by their index) when they can finally board the train.
Example:
Input:
3
0 1 5
1 2 3
3 1 4
Output:
1 2 3
Key concepts
queuesimulationfifo
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