Uber interview question

A graph problem above topological sort