Job queue scheduling
A media box transcodes uploads on one worker that hands out its time in fixed slices. job_ids names each upload, arrival_seconds[i] is the second job i lands in the queue, and burst_seconds[i] is the work it needs, at least one second. The worker takes the job at the front of the ready queue and runs it for quantum seconds, at least one, or for whatever work it has left if that is less. A job with work still left goes to the back of the queue. Jobs that arrive at the exact second a slice ends join the queue before the preempted job returns to it, and jobs arriving in the same second join in the order they are listed. While the queue is empty the worker idles until the next arrival. Return the job ids in the order they finish, and an empty list for no jobs. Ids are distinct.
transcode_finish_order(job_ids: list[str], arrival_seconds: list[int], burst_seconds: list[int], quantum: int) → list[str][["clip_a","clip_b","clip_c"],[0,0,0],[5,2,4],3]out["clip_b","clip_a","clip_c"][["intro","credits"],[0,4],[10,2],4]out["credits","intro"][["solo"],[7],[3],2]out["solo"]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.
[["clip_a","clip_b","clip_c"],[0,0,0],[5,2,4],3]["clip_b","clip_a","clip_c"]not run yetsample[["intro","credits"],[0,4],[10,2],4]["credits","intro"]not run yetsample[["solo"],[7],[3],2]["solo"]not run yetsample