revise two sum to O(n)