Pregunta de entrevista de Amazon

BFS tree question, you must do leetcode medium