Available question text
Count the number of distinct non-empty subsequences of a string modulo 1e9+7. This is typically solved with dynamic programming that doubles the count for each new character but corrects for duplicates by subtracting contributions from the character's previous occurrence (n ≤ 2000, lowercase letters).
Related questions
Continue with questions that share topics or the same question type.
- Distinct Subsequences
Coding · Dynamic Programming · String
- Count Different Palindromic Subsequences
Coding
- Count Distinct Numbers on Board
Coding
- Count Distinct Ways to Cross a River with Jumps of Up to 3
Coding
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 940. Distinct Subsequences II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source