Unity interview question

Breadth first search algorithm, similar to leetcode