Maximizes value from items placed in a weight-limited knapsack.
Step 1 of 39
0/1 Knapsack: 4 items, capacity = 8. Build a (5)×(9) table where dp[i][w] = max value using first i items with capacity w.
Legend
dp[i][w] = max value using the first i items with weight capacity w. Rows = items, columns = capacity.