Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.