@Anshu >> first check that particular number can be written as the sum of two squares or not What would be the way to figure it out.
>> O(n * (number of side which is largest one for any triplet)) Didn't get it. Thanks, - Ravindra On Wed, Oct 19, 2011 at 11:09 AM, anshu mishra <anshumishra6...@gmail.com>wrote: > @Ravindra > may be the interviewer wants from u that instead of blindly checking for > every number. first check that particular number can be written as the sum > of two squares or not if yes than only search for that number. So the order > will be decrease from O(n^2) to O(n * (number of side which is largest one > for any triplet)) and in practical it will be much less compare to O(n^2); > > -- > 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.