Domanda di colloquio di Bloomberg

A recursive graph algorithm question which is hard