Given array of integers, find the first pair add up to 10. Analize your solution.
Sigiloso
using hashmap, loop through the array once, and populate the map with 10-array[i] as key and i as value. loop again and check the map if map.get(array[i]) != null. if the map has a value the value is the index of the other number. break out of the loop. (part that I didn't answer is about 5,5 case that you have to check value from the map must not be the same as the current index.) This is O(2n) = O(n), linear solution.