@Rahul Pls elaborate with an example ...
On Fri, Oct 14, 2011 at 2:35 PM, rahul patil <rahul.deshmukhpa...@gmail.com>wrote: > You can take advantage of a basic property of triagle that > > sum of largest side of triangle < sum of other two sides, > > After sorting you could easily deside the range in which possible solution > could be found for a chosen hypotenuse > > On Fri, Oct 14, 2011 at 11:10 AM, ravindra patel <ravindra.it...@gmail.com > > wrote: > >> @Wladimir, yeah I have heard about that. Another way of populating >> primitive pythagoreans is, for any natural number m > 1 (m^2 - 1, 2m, m^2 + >> 1) forms a pythagorean triplet. This is useful in populating pythagorean >> tiplets but here the problem is to search such triplets from a given int >> array. >> >> @ rahul, Hash of z^2 - x^2 for each pair of z,x itself will of the size >> n*(n-1). I am not sure how it will work in O(n) time then. >> >> Thanks, >> - Ravindra >> >> >> On Fri, Oct 14, 2011 at 12:25 AM, Ankur Garg <ankurga...@gmail.com>wrote: >> >>> @rahul...How do u choose z and x for computing z^2 -x^2 ? >>> >>> On Thu, Oct 13, 2011 at 11:34 PM, rahul <rahul...@gmail.com> wrote: >>> >>>> You can create a hash with sqrt(z2-x2). This will make it o(n). The >>>> interviewer just made it lil tricky. That's all >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msg/algogeeks/-/2Ge2pjt4N-4J. >>>> To post to this group, send email to algogeeks@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. >>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@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. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@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. >> > > > > -- > Regards, > Rahul Patil > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@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. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.