Pergunta de entrevista da empresa Lyft

Dfs related coding problem from leetcode