Pergunta de entrevista da empresa Citadel Securities

Second question in interview was basic topological sort.