Skip to content

Commit 9fa364a

Browse files
authored
Update index.ts
1 parent 12a871a commit 9fa364a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

longest-palindromic-substring/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function longestPalindrome(s: string): string {
77
const str1 = expand(s, i, i);
88
const str2 = expand(s, i, i + 1);
99
ans = [str1, str2].reduce((p, v) => (p.length > v.length ? p : v), ans);
10-
10+
if(ans===s)return s
1111
i = i + 1;
1212
}
1313
return ans;

0 commit comments

Comments
 (0)