Knapsack Variations
You know the core 0/1 knapsack. Now learn unbounded knapsack, bounded copies, and value-based state design.
Lessons
1. Intro
What you'll learn
2. Max Value to True/False
The shift
3. LeetCode 416 Partition Equal Subset Sum - Problem Statement
LeetCode 416
4. LeetCode 416 Partition Equal Subset Sum - The Hidden Knapsack
Finding the pattern
5. LeetCode 416 Partition Equal Subset Sum - Boolean State Design
True or false
6. LeetCode 416 Partition Equal Subset Sum - Implementation
The code
7. LeetCode 416 Partition Equal Subset Sum - Walkthrough
Tracing subset sum
8. Lessons from Partition
summary
9. Challenge: Partition Reconstruction
Finding the actual subsets
10. Quiz: Subset Sum Basics
Knowledge check
11. LeetCode 494 Target Sum - Problem Statement
LeetCode 494
12. LeetCode 494 Target Sum - Converting Signs to Subsets
The math
13. LeetCode 494 Target Sum - Implementation
The code
14. LeetCode 494 Target Sum - Walkthrough
Signs to subsets
15. Quiz: Target Sum Transform
Testing the reduction
16. Finding One to Counting All
The shift
17. LeetCode 518 Coin Change II - Problem Statement
LeetCode 518
18. LeetCode 518 Coin Change II - Combinations vs Permutations
The trap
19. LeetCode 518 Coin Change II - Loop Order
The fix
20. LeetCode 518 Coin Change II - Implementation
The code
21. LeetCode 518 Coin Change II - Walkthrough
Counting combinations
22. Lessons from Counting Knapsack
summary
23. Challenge: Combinations vs Permutations
Understanding loop order
24. Quiz: Counting in DP
Knowledge check
25. Unlimited to Limited
The constraint
26. Bounded Knapsack - Problem Statement
Classic variation
27. Bounded Knapsack - Why Naive Is Slow
The problem
28. Bounded Knapsack - Binary Representation
The trick
29. Bounded Knapsack - Implementation
The code
30. Bounded Knapsack - Walkthrough
Limited quantities
31. Quiz: Binary Splitting
Why it works
32. Quiz: Knapsack Types
Knowledge check
33. One Constraint to Two
Multiple limits
34. LeetCode 474 Ones and Zeroes - Problem Statement
LeetCode 474
35. LeetCode 474 Ones and Zeroes - Two Capacities
3D state
36. LeetCode 474 Ones and Zeroes - Implementation
The code
37. LeetCode 474 Ones and Zeroes - Walkthrough
2D knapsack trace
38. LeetCode 1049 Last Stone Weight II - Problem Statement
LeetCode 1049
39. LeetCode 1049 Last Stone Weight II - Hidden Subset Sum
The observation
40. LeetCode 1049 Last Stone Weight II - Implementation
The code
41. LeetCode 1049 Last Stone Weight II - Walkthrough
Hidden subset sum
42. Quiz: Last Stone Reduction
Understanding the transform
43. Practice - Subset Sum Count
Apply counting pattern
44. What's Next
Preview of 2D grid DP
45. Pattern - Choosing the Right Variation
Decision guide
46. Section Recap
What we learned
Practice Problems
Classic unbounded knapsack counting combinations
Unbounded knapsack finding minimum count
Classic unbounded knapsack maximizing pieces
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Stack blocks with weight constraints - teaches sorting before DP and exchange argument.