You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/005 Longest Palindromic Substring.py
+24-2Lines changed: 24 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,9 @@
2
2
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
3
3
'''
4
4
5
+
5
6
classSolution(object):
6
-
deflongestPalindrome(self, s):
7
+
deflongestPalindrome2(self, s):
7
8
"""
8
9
:type s: str
9
10
:rtype: str
@@ -21,7 +22,8 @@ def longestPalindrome(self, s):
21
22
m=0
22
23
# Length of the current substring
23
24
c=0
24
-
# Whether the substring contains the first character or last character and is palindromic
25
+
# Whether the substring contains the first character or last character
0 commit comments