Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1955. Count Number of Special Subsequences
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source