You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
return math.comb(n + k - 1, k) % 10 ** 9
Explanation:
See section Number of combinations with repetition here: https://en.wikipedia.org/wiki/Combination
Seems like cookies are disabled on this browser, please enable them to open this website
K Candy Store
You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
Explanation:
See section Number of combinations with repetition here: https://en.wikipedia.org/wiki/Combination