Amazon interview question

Leetcode qs, med and hard.