Pregunta de entrevista de LiveRamp

Leetcode question that involved BFS/DFS