We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1bb337 commit 2932d1bCopy full SHA for 2932d1b
C++/number-of-unique-good-subsequences.cpp
@@ -10,9 +10,9 @@ class Solution {
10
bool has_zero = false;
11
for (const auto& b : binary) {
12
if (b == '1') {
13
- ends1 = (ends1 + ends0 + 1) % MOD; // add extra ends0 new distinct subsequences by a mapping rule and add one "1"*count_of_curr_1s
+ ends1 = (ends0 + ends1 + 1) % MOD; // curr subsequences end with 1 is all prev distinct subsequences appended by 1 and plus "1"
14
} else {
15
- ends0 = (ends0 + ends1) % MOD; // add extra ends1 new distinct subsequences by a mapping rule and don't add one "0"*count_of_curr_0s
+ ends0 = (ends0 + ends1) % MOD; // curr subsequences end with 0 is all prev distinct subsequences appended by 0 and don't plus "0"
16
has_zero = true;
17
}
18
0 commit comments