Amazon interview question

Online Coding Challenge: Leetcode Medium/Hard Interview: Leetcode Easy/Medium