Stars and bars

Write codeMedium22 minCitadel style

Your task

Count the number of ways to distribute n identical items into k distinct bins where each bin gets zero or more items (i.e. the number of non-negative integer solutions to x1+...+xk = n). This is the stars-and-bars count C(n+k-1, k-1), taken modulo 10^9+7. Constraints: 0 <= n <= 100000, 1 <= k <= 100000.

Examples

stars_and_bars(n: int, k: int) -> int
Example 1
Inputstars_and_bars(3, 2)
Output4