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 25f5020 commit 7cbe849Copy full SHA for 7cbe849
โvalid-palindrome/devyulbae.pyโ
@@ -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
19
class Solution:
20
def isPalindrome(self, s: str) -> bool:
-
21
+ filtered_s = ''.join(char.lower() for char in s if char.isalnum())
22
+ return filtered_s == filtered_s[::-1]
0 commit comments