Amazon interview question

Leetcode questions - graph, trees question