Search
⌘K

Leetcode 3317. Find the Number of Possible Ways for an Event

Count the ways to assign n labeled performers to x distinguishable stages (some stages may be empty) and then give each non-empty stage a score from 1..y, with the total taken modulo 1e9+7. Equivalently, compute the sum over k (number of non-empty stages) of C(x,k)*S(n,k)*k!*y^k, so the main challenge is efficiently computing Stirling numbers and binomial coefficients under the modulus for n,x,y up to 1000.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.