Question d’entretien chez Amazon

BFS through a maze question