All knapsack problems follow this structure:
Items with attributes (weight, value, count limit)
Capacity constraint (total weight, budget, time)
Improvement goal (max value, min cost, count ways) Choose your formulation based on constraints: small means standard , large with small values means value-based , items repeat means unbounded .
Recognize the pattern, pick the right formulation, write the transition. That's the knapsack framework.