Amazon Interview Question

Leetcode easy medium and hard