loading…
Write coin_change(coins, amount) returning the fewest coins that make amount, or -1 if impossible. You have unlimited coins of each value.
coin_change([1, 2, 5], 11) -> 3 # 5 + 5 + 1
coin_change([2], 3) -> -1
Stuck on the idea itself? The recursion & dp lesson walks through the pattern from scratch.