Skip to content

Commit e645851

Browse files
committed
valid-palindrome
1 parent 489033d commit e645851

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

valid-palindrome/changhyumm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def isPalindrome(self, s: str) -> bool:
3+
# 시간복잡도 O(n)
4+
# loop
5+
s_list = [x.lower() for x in s if x.isalnum()]
6+
# 시간복잡도 O(n)
7+
# loop + list pop()
8+
for i in range(len(s_list)//2):
9+
if s_list[i] != s_list.pop():
10+
return False
11+
return True

0 commit comments

Comments
 (0)