Pergunta de entrevista da empresa Increff

Graph question without topological sorting technique