Code RoomJob completion times
HardPrep Room Coding #4927

Job completion times

CodingAlgorithms & data structuresMid–Staff~30 min

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.

Implement
render_finish_minutes(arrives: list[int], work: list[int], due: list[int]) → list[int]
Examples
in[[0,0],[3,2],[10,5]]out[5,2]
in[[0,4],[5,2],[10,6]]out[7,6]
in[[0,10],[2,3],[5,9]]out[2,13]
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
[[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