Pregunta de entrevista de Citadel Securities

Second question in interview was basic topological sort.