Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count(n):
- dp={}
- arr=[3,5,10]
- def help(coins,val):
- if val==0:return 1
- if coins<0 or val<0:return 0
- if (coins,val) in dp:return dp[(coins,val)]
- ans=0
- ans+=help(coins,val-arr[coins])+help(coins-1,val)
- dp[(coins,val)]=ans
- return ans
- return help(2,n)
Advertisement
Add Comment
Please, Sign In to add comment