Pregunta de entrevista de Google

its graph question. topological sort