Pergunta de entrevista da empresa EY

Leetcode hard question based on graph