@gaurav
f(i, j) = {(total number we need to make sum j including ith number in
array), if its not possible than -1};f(i, j) = f(i-1, j-ar[i]) + 1 --> if (i-1, j-ar[i]) != -1; answer will be the largest j for which f(i, j) will be exactly equals to n/2; there is something more in this but when you start to write the code you can easily get that. https://www.spoj.pl/problems/AMR10D/ a little bit similar problem on spoj. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
