We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19d1776 commit 904339dCopy full SHA for 904339d
coin-change/printjin-gmailcom.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def coinChange(self, coins, amount):
3
+ dp = [float('inf')] * (amount + 1)
4
+ dp[0] = 0
5
+ for coin in coins:
6
+ for x in range(coin, amount + 1):
7
+ dp[x] = min(dp[x], dp[x - coin] + 1)
8
+ return dp[amount] if dp[amount] != float('inf') else -1
0 commit comments