class Solution:
def change(self, amount, coins):
"""
:type amount: int
:type coins: List[int]
:rtype: int
"""
dp=[0]*(amount+1)
dp[0]=1
for coin in coins:
for i in range(amount+1):
if i+coin<=amount:
dp[i+coin]+=dp[i]
return dp[amount]
网友评论