Pregunta de entrevista de Bloomberg

A recursive graph algorithm question which is hard