Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The "n choose r" function. nCr = n!/(r!*(n-r)!)
- def nCr(n, r):
- if n<0 or r<0:
- return -1
- if r>n:
- return 0
- return factorial(n) / (factorial(r) * factorial(n - r))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement