Example
Choose the fewest coins by reusing smaller amount cells.
highlighted = computed this step
Step 1 — Coin set
Compute the highlighted combinatorics value.
coins(1, 3, 4)
Step 2 — Amount 0
Compute the highlighted combinatorics value.
amount, candidates, min coins(0, (base), 0)
Step 3 — Amount 1
Compute the highlighted combinatorics value.
amount, candidates, min coins(1, ((1, 0, 0, 1)), 1)
Step 4 — Amount 2
Compute the highlighted combinatorics value.
amount, candidates, min coins(2, ((1, 1, 1, 2)), 2)
Step 5 — Amount 3
Compute the highlighted combinatorics value.
amount, candidates, min coins(3, ((1, 2, 2, 3), (3, 0, 0, 1)), 1)
Step 6 — Amount 4
Compute the highlighted combinatorics value.
amount, candidates, min coins(4, ((1, 3, 1, 2), (3, 1, 1, 2), (4, 0, 0, 1)), 1)
Step 7 — Amount 5
Compute the highlighted combinatorics value.
amount, candidates, min coins(5, ((1, 4, 1, 2), (3, 2, 2, 3), (4, 1, 1, 2)), 2)
Step 8 — Amount 6
Compute the highlighted combinatorics value.
amount, candidates, min coins(6, ((1, 5, 2, 3), (3, 3, 1, 2), (4, 2, 2, 3)), 2)
combinatorics-search
Every row is intentionally ordered and pinned to the lesson specification.