little strokes fell great oaks.
Backpack with Value array: function: dp[i][j] = Math.max(dp[i - 1][j - A[i - 1]] + V[i - 1], dp[i - 1][j]); (when you take that ith item) or dp[i][j] += dp[i - 1][j]; (when you don't take that ith item)
No comments:
Post a Comment