def coinchange(amountofchange):
if mem[amountofchange]==-1:
if amountofchange==0:
mem[amountofchange] = 0
else:
m = amountofchange
for i in range(len(coin)):
if coin[i]<=amountofchange:
x = 1+coin(amountofchange-coin[i])
m = min(m,x)
mem[amountofchange] = m
return mem[amountofchange]
我可以记住但无法找到一种动态的方式