Dsa
Queue
Medium
Job Queue Scheduler
You are building a job scheduler that processes tasks in a round-robin manner. Each task has a required processing time. The scheduler processes each task for a fixed time slice before returning to the queue.
Input Format:
- The first line contains two integers: n (number of tasks) and t (time slice).
- The next n lines contain one integer each representing the processing times of the tasks.
Output Format:
- Output the order of task completions with their original indices.
Example Input:
5 2
3
2
7
1
4
Example Output:
1
2
4
3
5
Key concepts
queueround robinscheduling
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