Skip to content

Commit 0c21985

Browse files
committed
valid palindrome solution
1 parent b89edee commit 0c21985

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

valid-palindrome/jungsiroo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import re
2+
3+
class Solution:
4+
def isPalindrome(self, s: str) -> bool:
5+
# Fastest - tc : O(n) / sc : O(1
6+
s = ''.join(re.findall(r'[a-z0-9]+', s.lower()))
7+
return s == ''.join(reversed(s))

0 commit comments

Comments
 (0)