Skip to content

Commit 7cbe849

Browse files
committed
feature-solved 2
1 parent 25f5020 commit 7cbe849

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
"""
2+
Blind75 - Valid Palindrome
3+
https://leetcode.com/problems/valid-palindrome/
4+
5+
์‹œ๊ฐ„๋ณต์žก๋„ O(n), ๊ณต๊ฐ„๋ณต์žก๋„ O(n)
6+
7+
isalnum() ํ•จ์ˆ˜๋Š” ์‹œ๊ฐ„๋ณต์žก๋„ O(1)์ด๋ฏ€๋กœ ํ•„ํ„ฐ๋งํ•˜๋Š” ๊ณผ์ •๋„ O(n)์ด๋‹ค.
8+
[::-1] ์Šฌ๋ผ์ด์‹ฑ๋„ O(n)์ด๋‹ค.
9+
๋”ฐ๋ผ์„œ ์ „์ฒด ์‹œ๊ฐ„๋ณต์žก๋„๋Š” O(n)์ด๋‹ค.
10+
11+
12+
Runtime Beats
13+
7ms 82.67%
14+
15+
Memory Beats
16+
23.14 MB 17.23%
17+
"""
18+
119
class Solution:
220
def isPalindrome(self, s: str) -> bool:
3-
21+
filtered_s = ''.join(char.lower() for char in s if char.isalnum())
22+
return filtered_s == filtered_s[::-1]

0 commit comments

Comments
ย (0)