We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d54c790 commit 9513930Copy full SHA for 9513930
125-valid-palindrome/125-valid-palindrome.py
@@ -0,0 +1,11 @@
1
+class Solution:
2
+ def isPalindrome(self, s: str) -> bool:
3
+ if not s:
4
+ return False
5
+ s = s.replace(" ", "")
6
+ s = s.lower()
7
+ r = ""
8
+ for x in s:
9
+ if x.isalnum():
10
+ r += x
11
+ return r == r[::-1]
0 commit comments