Intuit interview question

A coding problem using topological sorts