We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8199c9 commit 6344174Copy full SHA for 6344174
valid-palindrome/KwonNayeon.py
@@ -0,0 +1,24 @@
1
+"""
2
+Title: 215. Valid Palindrome
3
+Link: https://leetcode.com/problems/valid-palindrome/
4
+
5
+Summary:
6
+ - Palindrome이라면 True, 아니라면 False를 반환하는 문제.
7
+ - Palindrome이란, 대문자를 소문자로 변환하고 알파벳과 숫자 이외의 문자를 제거한 후에도
8
+ 앞으로 읽어도 뒤에서부터 읽어도 동일한 단어를 뜻함.
9
+ - e.g. racecar
10
11
+Conditions:
12
+ - 입력 문자열이 Palindrome인 경우: `True` 반환
13
+ - Palindrome이 아닌 경우: `False` 반환
14
15
+Time Complexity:
16
+ - O(n)
17
18
19
+class Solution:
20
+ def isPalindrome(self, s: str) -> bool:
21
+ s = re.sub(r'[^a-zA-z]', '', s).lower()
22
+ if s == s[::-1]:
23
+ return True
24
+ return False
0 commit comments