TuSimple Interview Question

A medium graph problem about top-sort.