What goes in the blank?
# fewest coins for every amount up to target
dp = [0] + [float('inf')] * target
for a in range(1, target + 1):
for c in coins:
if c <= a:
dp[a] = min(dp[a], dp[a - c] + ____)
Answer: 1
Using coin c costs one coin on top of the best answer for the remaining a - c.
Play Problem Solving ▸