Skip to content

Commit 902169f

Browse files
authored
Update number-of-unique-good-subsequences.py
1 parent 2932d1b commit 902169f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/number-of-unique-good-subsequences.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def numberOfUniqueGoodSubsequences(self, binary):
1212
has_zero = False
1313
for b in binary:
1414
if b == '1':
15-
ends1 = (ends1+ends0+1)%MOD # add extra ends0 new distinct subsequences by a mapping rule and add one "1"*count_of_curr_1s
15+
ends1 = (ends0+ends1+1)%MOD # curr subsequences end with 1 is all prev distinct subsequences appended by 1 and plus "1"
1616
else:
17-
ends0 = (ends0+ends1)%MOD # add extra ends1 new distinct subsequences by a mapping rule and don't add one "0"*count_of_curr_0s
17+
ends0 = (ends0+ends1)%MOD # curr subsequences end with 0 is all prev distinct subsequences appended by 0 and don't plus "0"
1818
has_zero = True
1919
return (ends0+ends1+int(has_zero))%MOD # add "0" if has_zero

0 commit comments

Comments
 (0)