This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingChoose each item at most once to maximize total value without exceeding the weight capacity.
What this asks
Choose each item at most once to maximize total value without exceeding the weight capacity.
dp[i][w] is the best value from the first i items under capacity w: skip the item, or take it and add its value to the best result with w minus its weight.
Try the matching visualizer modeThe full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing