Round-robin scheduler

Write codeMedium25 minMicrosoft style

Your task

Simulate a single-CPU round-robin scheduler. You are given a list of tasks as [name, burst] (CPU time each needs) in arrival order, all present at time 0, and a quantum. Each turn the CPU runs the front task for min(quantum, remaining) time units, advancing the clock; if the task still has work left it goes to the back of the queue, otherwise it completes. Return a list of [name, completion_time] in the order tasks complete.

Examples

round_robin(tasks: list[list], quantum: int) -> list[list]
Example 1
Inputround_robin([["A", 4], ["B", 2]], 2)
Output[["B", 4], ["A", 6]]