Citadel interview question

a problem about graph and bfs