Pregunta de entrevista de ByteDance

Graph problem, likely to be topological sort