we can merge the 2 arrays in sorted manner. Now from the 2nd last number,we can have the first pair (last,second last).From the 3rd last,we can have 2 pairs (last,3rd last) and (2nd last,3rd last). similarly we will keep on taking till we get n pairs.....
time complexity: O(2n+n)-> O(n) space complexity: O(2n)->O(n) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.