Job completion times
A render farm has one machine, and jobs may be paused and resumed at whole minutes at no cost. Job i arrives at minute arrives[i], needs work[i] minutes of the machine, and is due at minute due[i]. The machine always runs the arrived, unfinished job with the earliest due minute, and a tie goes to the lower job index. It switches the moment a job with an earlier due minute arrives, and it idles when nothing has arrived. Return the minute at which each job finishes, in input order: a job that starts at minute 0 and gets three uninterrupted minutes finishes at minute 3. Jobs are listed in any order, work is at least 1, and several jobs may arrive in the same minute.
render_finish_minutes(arrives: list[int], work: list[int], due: list[int]) → list[int][[0,0],[3,2],[10,5]]out[5,2][[0,4],[5,2],[10,6]]out[7,6][[0,10],[2,3],[5,9]]out[2,13]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,0],[3,2],[10,5]][5,2]not run yetsample[[0,4],[5,2],[10,6]][7,6]not run yetsample[[0,10],[2,3],[5,9]][2,13]not run yetsample