Amazon Interview Question

Two sum problem from leetcode