i have a n^2logn solution sort the third array,.. then for every pair in a and b search for the number which makes the sum zero using binary search
but guess a better soln must exist On Thu, Feb 17, 2011 at 11:38 PM, bittu <[email protected]> wrote: > We have three arrays > A=[a1,a2,...an] > B=[b1,b2,...bn] > C=[c1,c2,...cn] > > Write a method which takes these three arrays as input and return true > if there is a combination [ai,bj,ck] such that ai+bj+ck = 0. > > O(n^3) solution is obvious. The questions is can we do better than > this? > > > > > > > > > > > > Thanks & Regards > Shashank Mani > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- With Regards, *Jalaj Jaiswal* (+919019947895) Software developer, Cisco Systems B.Tech IIIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
