Amazon interview question

Topological sorting algorithm with machine learning context