Find two numbers in an array that sum up to 0.
Anonymous
Take each number (num) and do it {res = 0-num} . Look for result (res) using binary search. So for e.g if my array is {5,6,-5,8} take num =5, compute res = 0 - num = -5, look for -5 using binary search in log n time, if you get it output {5, -5}. For n number it will take O(nlogn) time.
Check out your Company Bowl for anonymous work chats.