Parallel job DAG completion times

Write codeHard30 minDatabricks style

Your task

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.

Examples

dag_completion_times(jobs: list[list[int]], deps: list[list[int]], K: int) -> list[list[int]]
Example 1
Inputdag_completion_times([[1, 3], [2, 2], [3, 4]], [[1, 3], [2, 3]], 2)
Output[[1, 3], [2, 2], [3, 7]]