Amazon Interview Question

All questions were directly from LeetCode.