```
class Solution(object):
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
if amount == 0:
return 0
memo = [-1]*(amount+1)
memo[0] = 0
for i in range(0,amount+1):
temp = []
for j in range(0,len(coins)):
if(i >= coins[j]):
if(memo[i] > 0):
memo[i]= min(memo[i],memo[i-coins[j]]+1)
else:
memo[i] = memo[i-coins[j]]+1
if memo[amount] == 0:
return -1
else:
return memo[amount]
```