Pregunta de entrevista de Google

Graph question with multiple scenarios to use bfs/dfs