Problems > Distributing Identical Coins > Editorial

Distributing Identical Coins — Solution & Editorial

Back to the Problem

Stars and bars: place K−1 dividers among N stars — C(N+K−1, K−1) arrangements. Compute with factorials mod p.

Complexity: O(N + K)