O(n) solution to ArrayPairSum problem