After squaring all the elements up and sorting them, couldn't we just do a binary search on the array.. so the TC would be O(nlogn)...
On Wed, Aug 10, 2011 at 1:18 PM, Kunal Patil <kp101...@gmail.com> wrote: > @Ankit: Ohh Sorry..I didnt actually read the question properly.. > I didnt see we have to check for sum which must be another element in the > array & not some user provided constant value..I mis-understood it with sum > upto k problem which can be solved on sorted array in O(n)... > thats why gave a wrong comment...my Bad.. > > -- > 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, Dinoj -- 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.