Mental Model
We want to pick items with values and weights to maximize value without exceeding weight limit. Each item can be chosen only once.
Analogy: Imagine packing a backpack for a trip. You have limited space (weight limit) and many items with different usefulness (value) and sizes (weight). You want to pack the most useful combination without overloading.
Items: [value, weight] [60, 10] [100, 20] [120, 30] Knapsack capacity: 50 Backpack capacity -> 50 Items to choose -> 3 Initial DP table (rows: items, cols: weight capacity): 0 -> 1 -> 2 -> ... -> 50 0 -> 0 -> 0 -> ... -> 0 ā Item 0 (no items chosen yet)
