Post

[코테] 125. Valid Palindrome

난이도:EasySolved

My Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Solution:
    def isPalindrome(self, s: str) -> bool:
        L, R = 0, len(s) - 1

        while L < R: 
            if not s[L].isalnum():
                L += 1
                continue
            if not s[R].isalnum():
                R -= 1
                continue

            if s[L].lower() != s[R].lower():
                return False

            L += 1
            R -= 1

        return True
This post is licensed under CC BY 4.0 by the author.