This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingMake an amount with the fewest coins, when each coin value may be used as many times as you like.
What this asks
Make an amount with as few coins as possible, when each coin value may be used as many times as you like.
memo[a] is the fewest coins that make exactly amount a: one plus the smallest memo[a - coin] over the coins that fit, with memo[0] = 0 and -1 for an amount no combination reaches. The memoized run solves each amount a call needs; the tabulated run fills amounts 1 to amount in order.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing