Amazon interview question

2 Leetcode easy problems + 1 medium