Skip to content

Commit 177f3b7

Browse files
committed
Update longest-palindromic-substring.py
1 parent 0e2e6ad commit 177f3b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Python/longest-palindromic-substring.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ def longestPalindrome(self, s):
1616
"""
1717
def preProcess(s):
1818
if not s:
19-
return "^$"
20-
T = "^"
21-
for i in s:
22-
T += "#" + i
23-
T += "#$"
19+
return ['^', '$']
20+
T = ['^']
21+
for c in s:
22+
T += ['#', c]
23+
T += ['#', '$']
2424
return T
2525

2626
T = preProcess(s)

0 commit comments

Comments
 (0)