SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def numberOfWays(amount,coinsOptions):
  2.     if (amount < 0):
  3.         return 0
  4.     elif(amount == 0):
  5.         return 1
  6.     else:
  7.         return sum([numberOfWays(amount - coin,coinsOptions) for coin in coinsOptions])
  8.  
  9. print(numberOfWays(4,[1,2]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top