Dsa
Queue
Easy
Multi-Stage Task Scheduler
You are building a multi-stage task scheduler where tasks need to be processed in multiple stages. Each task can be processed in multiple steps. Implement a program that manages a queue of tasks where each task consists of a series of stages. Each stage takes a specific amount of time to complete. If a new task arrives, it joins the end of the queue. Output the order of tasks being worked on after each stage, maintaining their processing order.
Input Format:
- The first line contains an integer S, the number of stages.
- The second line contains an integer T, the number of tasks.
- Each of the following T lines contains a list of integers representing the time for each stage of that task.
Output Format:
- The order of tasks processed after completing each stage.
Example:
Input:
2
2
3 2
1 4
Output:
1
1 2
Key concepts
queuetask schedulingmulti-stage processing
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