@vishal,Sanjeev.. for the inputs 18,187.. apply ur method.. 18 -- 188 187-- 187
18187 -> ur method 18718 -> actual @Sunny... i agree that your algorithm takes the *O(N logN)* time.. but again.. the problem is it* doesn't get* the exact solution. Do we really have a polynomial solution for this one? I think this falls under the NP category. -- 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.