1 & 167. Two Sum I & II ( Input array is sorted )
There is an array with integers, if there is sum of two numbers equals target, return true; if there is not, return false.
Solution:
Input array is sorted:
O(NlogN)
Use binary search or two pointers.
Unsorted:
O(N)
Use hash map, key = target - a[i], value = a[i]
Search and find containsKey