Code RoomRound-robin scheduler
MediumPrep Room Coding #1018

Round-robin scheduler

CodingConcurrencyMid–Senior~30 min

Simulate a deterministic single-CPU round-robin scheduler with a fixed time quantum. You get `tasks` as a list of [name, arrival, burst] (integers, arrival non-decreasing in input order) and an integer `quantum`. At each step the CPU runs the front task for min(quantum, remaining) ticks; if it still has work it goes to the BACK of the ready queue, but any tasks that ARRIVED during those ticks (arrival <= current_time after running) are enqueued BEFORE the preempted task is re-added. Ties in arrival keep input order. Return the list of task names in the order they COMPLETE.

Implement
round_robin(tasks: list[list], quantum: int) → list[str]
Examples
in[[["A",0,5],["B",0,3]],2]out["B","A"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 30 min
InputExpectedGot
[[["A",0,5],["B",0,3]],2]["B","A"]not run yetsample