Two Sum Problem Analysis 1: Sort and Hash with unique solution

We analyze how to solve the classic two sum problem under the assumption that there is only one unique solution: 1) using sort and head/tail pointers with O(NlogN) time complexity 2) using hash table with O(N) time complexity. Further analysis about duplicates in the input would be discussed in later posts and this one could be a good recap or preparation for that.
Read More