Skip to content

Commit dfb6f0c

Browse files
committed
Fix: Include numeric characters in palindrome check
1 parent dd6ca48 commit dfb6f0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

valid-palindrome/KwonNayeon.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
1515
Time Complexity:
1616
- O(n)
17+
Space Complexity:
18+
- O(n)
1719
"""
1820
class Solution:
1921
def isPalindrome(self, s: str) -> bool:
20-
s = re.sub(r'[^a-zA-z]', '', s).lower()
21-
if s == s[::-1]:
22-
return True
23-
return False
22+
s = re.sub(r'[^a-zA-z0-9]', '', s).lower()
23+
if s == s[::-1]

0 commit comments

Comments
 (0)