Pregunta de entrevista de EY

Leetcode hard question based on graph