Question DSA-DP-0009
MediumWhat is the output of this code?
coins, amt = [1, 2, 5], 5
dp = [1] + [0] * amt
for c in coins:
for x in range(c, amt + 1):
dp[x] += dp[x - c]
print(dp[amt])
- A.
2
- B.
3
- C.
Sign up free to see the answer and a step-by-step explanation.