Amazon Common Leetcode Question