TuSimple interview question

a graph problem in disguise