Skip to content

Commit aa2c4e6

Browse files
authored
onlybooks#38 Fix inefficient approach.
1 parent d19b107 commit aa2c4e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2-python/ch06/6-1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ class Solution:
22
def longestPalindrome(self, s: str) -> str:
33
# 팰린드롬 판별 및 투 포인터 확장
44
def expand(left: int, right: int) -> str:
5-
while left >= 0 and right <= len(s) and s[left] == s[right - 1]:
5+
while left >= 0 and right < len(s) and s[left] == s[right]:
66
left -= 1
77
right += 1
8-
return s[left + 1:right - 1]
8+
return s[left + 1:right]
99

1010
# 해당 사항이 없을때 빠르게 리턴
1111
if len(s) < 2 or s == s[::-1]:

0 commit comments

Comments
 (0)