Hyro interview question

A question that requierd knowledge with BFS algorithm