Concept Flow - 0 1 Knapsack Problem
Start with empty knapsack
For each item i
For each weight w from 0 to max capacity
Check if item i fits (weight[i
Yes No
Include item i: value[i
Take max of include/exclude
Fill dp table
Answer is dp[number_of_items
We fill a table where each cell shows the best value for items up to i and capacity w, choosing to include or exclude the current item.
