Amazon Interview Question

very common easy leetcode question, two sum level