bursts[i] is the CPU time needed by process i. All processes are ready at time 0 and are placed in a queue in index order. A round-robin scheduler repeatedly takes the process at the front and runs it for at most quantum time units; if the process still needs more time it goes to the back of the queue, otherwise it finishes.
Return a list where element i is the time at which process i finishes.
Examples
Input: bursts = [5, 3, 8], quantum = 2
Output: [12, 9, 16]
Explanation: timeline 0-2 P0, 2-4 P1, 4-6 P2, 6-8 P0, 8-9 P1 (done), 9-11 P2, 11-12 P0 (done), 12-14 P2, 14-16 P2 (done).
Input: bursts = [4], quantum = 10
Output: [4]
Constraints
0 <= len(bursts) <= 50001 <= bursts[i] <= 100,1 <= quantum <= 100- Target:
O(total number of time slices)
Goals
- Simulate a CPU scheduler with a time quantum
- Record per-process results by original index while the queue rotates