ByteDance interview question

BFS problem.