Uber Interview Question

A graph problem above topological sort