Coin Change 2 LeetCode Challenge June Day 7
Approach: Using Dynamic Programming
Python Code:
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
v = [0] * (amount + 1)
v[0] = 1
for i in coins:
for j in range(i, amount + 1):
v[j] += v[j - i]
return v[amount]
0 Comments