Pergunta de entrevista da empresa Uber

Leetcode hard problem related to graphs and DFS.