Skip to content

Commit 9513930

Browse files
committed
Time: 68 ms (55.44%), Space: 14.4 MB (57.15%) - LeetHub
1 parent d54c790 commit 9513930

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)