trivial solution will be exponential where we check for each selection nC1+nC2...nCn = 2^n
we can optimise time by taking some memory. It can be solved by subset sum where we will require extra memory of maximum sum possible. refer this link for subset sum problem: http://en.wikipedia.org/wiki/Subset_sum_problem -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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.