Pregunta de entrevista de Amazon

Course schedule problem using topological sort