Dsa
Queue
Medium
Customer Service Desk
You are simulating a customer service desk where customers wait to be served. Customers arrive at varying intervals. Each customer has a unique ID and a ticket number, which is the order they arrive. Your program should simulate the serving of customers based on the order of their ticket numbers. If a customer is served, they are removed from the queue. Your program should read a sequence of customers and print the order in which they were served.
Example:
Input:
5
1 1
2 4
3 2
4 3
5 5
Output:
1
3
4
2
5
Key concepts
queueprocessingsimulation
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