How can I write an algorithm to check if the sum of any two numbers in an array/list matches a given number
with a complexity of nlogn
?
Let us say that we want to find two numbers in the array A that when added together equal N.
The sort can be done in O(n log n). The search is done in linear time.