This is a question from yahoo. Find 3 numbers from two arrays A and B . Input : unsorted arrays A and B. Output: The sets of three numbers which sums to M. There are many kinds of results to meet the demand.
Request: one number from A, the other two from B; or one number from B, the other two from A.The space complexity O(1), make effort to reduce the time complexity.
How to implement and avoid the duplicate tuples? This qustion likes questions from here. But is there some easy method to solve? I want to know how to avoid the duplicate result from two arrays? If we do not sort the arrays, can we implement the algorithm with same demands.