Problem Setup

Optimal Solution

0

Maximum value achievable

0
Used Capacity
7
Total Capacity
0
Items Selected

Dynamic Programming Table

The table shows the maximum value for each subproblem (i items, w capacity)

How it works

Click on any cell in the table to see a detailed explanation of how its value was calculated.

DP Transition Formula:
dp[i][w] = max(dp[i-1][w], dp[i-1][w - weight[i-1]] + value[i-1])