Pergunta de entrevista da empresa Bloomberg

A recursive graph algorithm question which is hard