Ezvor

3647. Maximum Weight in Two Bags

MediumArray Preparing judge… LeetCode
ArrayDynamic Programming

Hints

Hint 1
Use dynamic programming.
Hint 2
Let dp[i][j] be the maximum total weight that can be held in the two bags when their current weights (or used capacities) are i and j, respectively.