Quant Memo
Coding/●●●●●

Is the settlement pipeline schedulable?

A settlement pipeline has n tasks. A dependency (a, b) means task a must run after task b. The pipeline is schedulable only if there is no circular dependency. Decide whether all tasks can be ordered.

n = 3, deps = [(1,0), (2,1)]    -> True    # run 0, then 1, then 2
n = 2, deps = [(0,1), (1,0)]    -> False   # 0 needs 1 and 1 needs 0

Return whether a valid ordering exists (no cycle in the dependency graph).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions