some one please help me how to approach http://www.spoj.com/problems/LPPP problem. I am not getting any idea how to solve this problem. Although i have read about how to divide an array into two sets of equal sum using dynamic programming but not able to get this one.
It's easy to imagine recursive DP:
Where a, b and c — amount of money for three brothers.
Now you should transform recursive DP into iterative.
Note you don't need to store value c, because a+b+c is constant and equals to coinValue[0]+... +coinValue[coinNumber]. So you need DP table dp[50 * 50 / 3][50 * 50 / 3]
@Alias thanks
Accepted now :)
but can you tell me how to solve this problem using bottom up approach as i don't get how to solve
this problem using bottom up approach , i solve this problem using memoizaton...