Skip to content

Commit c43e1f4

Browse files
committed
feat: update solutions to lc problem: No.0032
1 parent 4816025 commit c43e1f4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

solution/0000-0099/0032.Longest Valid Parentheses/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ function longestValidParentheses(s: string): number {
230230
const n = s.length;
231231
const f: number[] = new Array(n + 1).fill(0);
232232
for (let i = 2; i <= n; ++i) {
233-
if (s[i - 1] == ')') {
234-
if (s[i - 2] == '(') {
233+
if (s[i - 1] === ')') {
234+
if (s[i - 2] === '(') {
235235
f[i] = f[i - 2] + 2;
236236
} else {
237237
const j = i - f[i - 1] - 1;
238-
if (j && s[j - 1] == '(') {
238+
if (j && s[j - 1] === '(') {
239239
f[i] = f[i - 1] + 2 + f[j - 1];
240240
}
241241
}

solution/0000-0099/0032.Longest Valid Parentheses/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ function longestValidParentheses(s: string): number {
189189
const n = s.length;
190190
const f: number[] = new Array(n + 1).fill(0);
191191
for (let i = 2; i <= n; ++i) {
192-
if (s[i - 1] == ')') {
193-
if (s[i - 2] == '(') {
192+
if (s[i - 1] === ')') {
193+
if (s[i - 2] === '(') {
194194
f[i] = f[i - 2] + 2;
195195
} else {
196196
const j = i - f[i - 1] - 1;
197-
if (j && s[j - 1] == '(') {
197+
if (j && s[j - 1] === '(') {
198198
f[i] = f[i - 1] + 2 + f[j - 1];
199199
}
200200
}

solution/0000-0099/0032.Longest Valid Parentheses/Solution.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ function longestValidParentheses(s: string): number {
22
const n = s.length;
33
const f: number[] = new Array(n + 1).fill(0);
44
for (let i = 2; i <= n; ++i) {
5-
if (s[i - 1] == ')') {
6-
if (s[i - 2] == '(') {
5+
if (s[i - 1] === ')') {
6+
if (s[i - 2] === '(') {
77
f[i] = f[i - 2] + 2;
88
} else {
99
const j = i - f[i - 1] - 1;
10-
if (j && s[j - 1] == '(') {
10+
if (j && s[j - 1] === '(') {
1111
f[i] = f[i - 1] + 2 + f[j - 1];
1212
}
1313
}

0 commit comments

Comments
 (0)