Skip to content

Commit 7775163

Browse files
committed
valid palindrome solution
1 parent 14a2041 commit 7775163

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

valid-palindrome/mrlee7.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import re
2+
3+
4+
class Solution:
5+
def isPalindrome(self, s: str) -> bool:
6+
result = re.sub(r'[^a-zA-Z0-9]', '', s).lower()
7+
return result == result[::-1]

0 commit comments

Comments
 (0)