Workspace/Coding labs
Loading progress

Compute a milestone critical path

Intermediate45 min

Implement milestone_finish(durations, dependencies). Durations are nonnegative finite numbers; every milestone must appear in both mappings. Dependencies list predecessor names. Return earliest finish time for each milestone assuming unlimited workers and zero handoff delay. Reject unknown dependencies, cycles, negative or nonfinite durations, and mismatched mappings. Empty mappings return {}. This is a lower bound for planning, not a staffing estimate.

Your task

  1. Complete the starter function using the contract above.
  2. Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
  3. Run tests to record your result, then compare with the explained reference solution.

Examples

EXAMPLE 1

Inputdurations={"data":2,"base":1,"ui":3,"demo":1}; dependencies={"data":[],"base":["data"],"ui":["data"],"demo":["base","ui"]}

Output{"data":2,"base":3,"ui":5,"demo":6}

The demo waits for the slower predecessor, not the sum of parallel branches.
solution.pyPython 3.12