Question
Simulate a preemptive priority scheduler with unit-time granularity. Tasks are [name, arrival, burst, priority] where a LOWER priority number means higher priority. At every integer tick, among all arrived, unfinished tasks the scheduler runs the one with the best (lowest) priority; ties broken by earliest arrival, then by input order. A running task can be preempted at any tick by a newly-arrived higher-priority task. Return the execution timeline as a list of (name, start, end) merged slices, where consecutive ticks of the same task on the CPU are coalesced into one slice. The CPU idles (skips) ticks where no task has arrived.
priority_schedule(tasks: list[list]) → list[list][[["A",0,4,2],["B",1,2,1]]]out[["A",0,1],["B",1,3],["A",3,6]]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.