Problem 1692 · Hard

Count Ways to Distribute Candies

Each new candy either joins one of the k bags or opens a new bag: S(n, k) = k S(n-1, k) + S(n-1, k-1).

Open the interactive visualisation