Dsa
Queue
Medium
Customer Service Ticket System
A customer service system processes tickets with different priorities. Each ticket takes a specific amount of time to resolve. You need to simulate the processing of these tickets and output the order in which they are resolved. High-priority tickets are processed first.
Input Format:
- The first line contains an integer n (number of tickets).
- The next n lines contain two integers: priority (1 = high, 2 = low) and time taken to resolve.
Output Format:
- Output the order of ticket resolution by their indices (1-based).
Example Input:
4
1 5
2 2
1 3
2 1
Example Output:
1
3
2
4
Key concepts
queueprioritysimulation
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