Skip to content

Commit 432fda4

Browse files
committed
valid palindrome solution
1 parent bc68cb3 commit 432fda4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

valid-palindrome/devyejin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# isalnum() : 문자열이 영어, 한글 숫자 -> True , 아니라면 False
2+
class Solution:
3+
def isPalindrome(self, s: str) -> bool:
4+
s = s.replace(" ", "")
5+
changed_s = [c.lower() for c in s if c.isalnum()]
6+
return changed_s == changed_s[::-1]

0 commit comments

Comments
 (0)