How about combining sum and multiplication in the first step. As in perform both sum and multiplication or may be sum of squares.
On Wed, Aug 18, 2010 at 8:50 PM, Rais Khan <raiskhan.i...@gmail.com> wrote: > @Chonku: Your algo seems to fail with following input. > Arr1[]= {1,6} > Arr2[]={7} > > > > > On Wed, Aug 18, 2010 at 8:42 PM, Rais Khan <raiskhan.i...@gmail.com>wrote: > >> @Nikhil: Your algo seems to fail with following input. What do you say? >> Arr1[]= {1,2,3} >> Arr2[]={6} >> >> >> >> >> On Wed, Aug 18, 2010 at 7:17 AM, Nikhil Agarwal < >> nikhil.bhoja...@gmail.com> wrote: >> >>> Sum all the elements of both the arrays..let it be s1 and s2 >>> Multiply the elements and call as m1 and m2 >>> if(s1==s2) &&(m1==m2) >>> return 1;else >>> return 0; >>> >>> O(n) >>> >>> On Tue, Aug 17, 2010 at 11:33 PM, amit <amitjaspal...@gmail.com> wrote: >>> >>>> Given two arrays of numbers, find if each of the two arrays have the >>>> same set of integers ? Suggest an algo which can run faster than NlogN >>>> without extra space? >>>> >>>> -- >>>> 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<algogeeks%2bunsubscr...@googlegroups.com> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>>> >>> >>> >>> -- >>> Thanks & Regards >>> Nikhil Agarwal >>> Senior Undergraduate >>> Computer Science & Engineering, >>> National Institute Of Technology, Durgapur,India >>> http://tech-nikk.blogspot.com >>> http://beta.freshersworld.com/communities/nitd >>> >>> >>> -- >>> 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<algogeeks%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> > -- > 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<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- 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.