Pregunta de entrevista de Street Simplified

a simple BFS problem with graphs