Search
⌘K
Get Premium
Leetcode 1955. Count Number of Special Subsequences
Count the number of subsequences that consist of a positive number of 0s followed by a positive number of 1s then a positive number of 2s (order preserved), returning the result modulo 1e9+7. The challenge is to count exponentially many valid subsequences efficiently for n up to 1e5, typically via a linear DP/state-counting approach.
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.