Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def countWays(n, k)
- amount = n
- combinations = k
- count = 1
- n = n - 1
- while (count < combinations)
- amount = amount * n
- count = count + 1
- n = n - 1
- end
- count = combinations - 1
- while (count > 1)
- combinations = combinations * count
- count = count - 1
- end
- return amount / combinations
- end
Advertisement
Add Comment
Please, Sign In to add comment