Knapsack, Subset Sum & Coin Change

Data Structures & Algorithms · Greedy & Dynamic Programming · Master · 30 min

Master the take-or-skip decision behind 0/1 knapsack, subset sum and coin change, tell 0/1 from unbounded, and shrink the table to a single row.

This lesson is part of TuringPath Pro. See plans.

What you will learn

  • The take / skip decision
  • 0/1 vs unbounded: one index changes
  • Space optimisation: one row, and the direction matters
  • Same skeleton, different questions
  • "Pseudo-polynomial": what O(n · cap) really means

More in Greedy & Dynamic Programming

Previous: 2D Dynamic Programming · Next: Bit Manipulation