Code Room
CodingHardcod-g1127
Subject SchedulingLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.