Amazon interview question

BFS question with a bar raiser Leetcode medium