Amazon Interview Question

I was given a Leetcode easy and medium.