Skip to content

Commit

Permalink
518
Browse files Browse the repository at this point in the history
  • Loading branch information
luanshiyinyang committed Dec 3, 2021
1 parent 0ff0477 commit 832d54b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 0518-Coin Change 2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
dp = [0] * (amount + 1)
dp[0] = 1
for coin in coins:
for i in range(coin, amount + 1):
dp[i] += dp[i-coin]
return dp[amount]

0 comments on commit 832d54b

Please sign in to comment.