Search
⌘K

Leetcode 2327. Number of People Aware of a Secret

Count how many people know a secret after n days when each person starts sharing every day beginning delay days after learning it and stops (forgets) after forget days. This reduces to a DP/sliding-window problem where new sharers on a day equal the sum of people who learned the secret between (day - forget + 1) and (day - delay), with the result modulo 1e9+7.


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.