Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def numberOfWays(amount,coinsOptions):
- if (amount < 0):
- return 0
- elif(amount == 0):
- return 1
- else:
- return sum([numberOfWays(amount - coin,coinsOptions) for coin in coinsOptions])
- print(numberOfWays(4,[1,2]))
Add Comment
Please, Sign In to add comment