Amazon interview question

All questions were directly from LeetCode.