Skip to content

Commit 9cf8488

Browse files
authored
feat: update solutions to lc problem: No.1987 (doocs#1492)
1 parent 2caad0d commit 9cf8488

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

solution/1900-1999/1987.Number of Unique Good Subsequences/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class Solution {
113113
f = (f + g + 1) % mod;
114114
}
115115
}
116-
ans = (ans + f) % mod;
117-
ans = (ans + g) % mod;
116+
ans = (ans + f + g) % mod;
118117
return ans;
119118
}
120119
}
@@ -137,8 +136,7 @@ public:
137136
f = (f + g + 1) % mod;
138137
}
139138
}
140-
ans = (ans + f) % mod;
141-
ans = (ans + g) % mod;
139+
ans = (ans + f + g) % mod;
142140
return ans;
143141
}
144142
};
@@ -178,8 +176,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number {
178176
f = (f + g + 1) % mod;
179177
}
180178
}
181-
ans = (ans + f) % mod;
182-
ans = (ans + g) % mod;
179+
ans = (ans + f + g) % mod;
183180
return ans;
184181
}
185182
```

solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ class Solution {
8989
f = (f + g + 1) % mod;
9090
}
9191
}
92-
ans = (ans + f) % mod;
93-
ans = (ans + g) % mod;
92+
ans = (ans + f + g) % mod;
9493
return ans;
9594
}
9695
}
@@ -113,8 +112,7 @@ public:
113112
f = (f + g + 1) % mod;
114113
}
115114
}
116-
ans = (ans + f) % mod;
117-
ans = (ans + g) % mod;
115+
ans = (ans + f + g) % mod;
118116
return ans;
119117
}
120118
};
@@ -154,8 +152,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number {
154152
f = (f + g + 1) % mod;
155153
}
156154
}
157-
ans = (ans + f) % mod;
158-
ans = (ans + g) % mod;
155+
ans = (ans + f + g) % mod;
159156
return ans;
160157
}
161158
```

solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class Solution {
1212
f = (f + g + 1) % mod;
1313
}
1414
}
15-
ans = (ans + f) % mod;
16-
ans = (ans + g) % mod;
15+
ans = (ans + f + g) % mod;
1716
return ans;
1817
}
1918
};

solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ public int numberOfUniqueGoodSubsequences(String binary) {
1111
f = (f + g + 1) % mod;
1212
}
1313
}
14-
ans = (ans + f) % mod;
15-
ans = (ans + g) % mod;
14+
ans = (ans + f + g) % mod;
1615
return ans;
1716
}
1817
}

solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ function numberOfUniqueGoodSubsequences(binary: string): number {
1010
f = (f + g + 1) % mod;
1111
}
1212
}
13-
ans = (ans + f) % mod;
14-
ans = (ans + g) % mod;
13+
ans = (ans + f + g) % mod;
1514
return ans;
1615
}

0 commit comments

Comments
 (0)