Skip to content

Commit 79812a5

Browse files
committed
feat: Add valid palindrome solution
1 parent aa151cd commit 79812a5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

valid-palindrome/river20s.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import re
2+
3+
class Solution(object):
4+
def isPalindrome(self, s):
5+
s = s.lower()
6+
s = re.sub(r'[^a-z0-9]', '', s)
7+
return s == s[::-1]

0 commit comments

Comments
 (0)