Coin Change II: Counting the Ways Token by Token – and Why Loop Order Matters
This lesson is part of the course
In this lesson
You fill a ways table token by token for amounts 0–12, check one cell against a hand list, then count ordered sequences in a second row and see how much larger that count is.
Buy the course once for $9.99 to unlock every lesson and lab, the final exam and the certificate – lifetime access, no subscription.
Lessons in this course
- Overlapping Subproblems: Counting the Calls of a Naive Recursion Locked
- Bottom-Up Tables: Ways to Climb n Stairs with 1-, 2- or 3-Steps Locked
- Coin Change I: The Fewest Tokens for an Amount, Impossible Amounts & Why Greedy Fails Locked
- Coin Change II: Counting the Ways Token by Token – and Why Loop Order Matters Locked
- 0/1 Knapsack: The Capacity × Item Grid, MAX(Skip, Take) and the Traceback Locked
- Longest Common Subsequence: Letters with MID, the LCS Grid and the Traceback Locked
- Grid Paths & Cheapest Paths: Blocked Squares, Cost Grids and the Way Back Locked
- Capstone: Longest Increasing Subsequence and Brute Force vs Dynamic Programming Locked