0/1 knapsack
What is the highest value?
Examples
Worked example
Input
Capacity 4. Items have (weight, value) (3,5), (2,4), and (2,3).
Expected output
7
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
The two weight-2 items fit together and have value 4 + 3. The weight-3 item cannot combine with either one.