How do you know there exist two numbers in a given array which add up to be a certain number? (given: array, target sum, return: true or false)
Anonymous
Use hash map to count the array, and go through the array and find if (target sum - current number) exist in the array. Be aware of array = [3] and sum = 6 type error, 3 cannot be used twice.
Check out your Company Bowl for anonymous work chats.