Microsoft Interview Question

leetcode question (medium level) that is related to breadth first search