Citadel interview question

A Leetcode question that uses BFS