Code Room
CodingMediumcod-g449
Subject Concurrency simulationLevel Mid–Senior~30 minCommon in Concurrency interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.