20/32
Part 5 of 7 · Rounds and timesLearn and do

With enough workers, a task starts when its last prerequisite finishes, or at 0 if it has none

So far every task took one minute.

minutes = {"fetch": 2, "compile": 5, "assets": 3, "test": 8, "package": 2, "docs": 4, "deploy": 1}

Now give the tasks real durations, still with as many workers as you need. A senior Netflix candidate reported a version of this: topological sort with the extra work of tracking when each prerequisite finishes (1 report).

A task starts when its last prerequisite finishes, or at 0 if it has none, and it finishes minutes[task] later:

finish(t)=minutes(t)+max⁡pfinish(p)\text{finish}(t) = \text{minutes}(t) + \max_{p} \text{finish}(p)

Here tt is a task and pp runs over its prerequisites. The max is 0 for a task with no prerequisites.

Predict

With as many workers as you like, at what minute is the whole pipeline done?

Pick an answer above to see the rest