Dsa
Queue
Hard
Customer Service Queue Management
A customer service center has a queue of customers waiting for service. Each customer has a specific time they require for service. The service center can only serve one customer at a time. Given a list of customers with their respective service times and a predefined number of servers available, calculate the total time when the last customer is served.
Input format:
- The first line contains an integer N (1 ≤ N ≤ 1000) representing the number of customers.
- The second line contains N space-separated integers where each integer represents the time required for each customer (1 ≤ time ≤ 100).
- The third line contains an integer M (1 ≤ M ≤ 10) representing the number of servers available.
Output format:
- A single integer, representing the time when the last customer finishes being served.
Example:
Input:
5
10 2 3 5 7
2
Output:
15
Key concepts
queuedata structuresimulation
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