Code RoomParallel job DAG completion times
HardPrep Room Coding #297

Parallel job DAG completion times

CodingAlgorithms & data structuresMid–Senior~30 min

Same model as a K-worker dependency-DAG scheduler, but instead of the makespan return each job's completion time. jobs is [id, duration]; deps is [a, b] (a before b); K workers; eligible jobs are dispatched to idle workers in ascending id order; non-preemptive. Return a list of [id, completion_time] sorted by id. The DAG is acyclic and ids are unique.

Implement
dag_completion_times(jobs: list[list[int]], deps: list[list[int]], K: int) → list[list[int]]
Examples
in[[[1,3],[2,2],[3,4]],[[1,3],[2,3]],2]out[[1,3],[2,2],[3,7]]
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
[[[1,3],[2,2],[3,4]],[[1,3],[2,3]],2][[1,3],[2,2],[3,7]]not run yetsample