<reponame>Lonitch/hackerRank
#
# @lc app=leetcode id=125 lang=python3
#
# [125] Valid Palindrome
#

# @lc code=start
class Solution:
    def isPalindrome(self, s: str) -> bool:
        l = 0
        r=len(s)-1
        s=s.lower()
        while l<r:
            while l<r and not s[r].isalnum():
                r-=1
            while l<r and not s[l].isalnum():
                l+=1
            if s[l]!=s[r]:
                return False
            l+=1
            r-=1
        return True
# Your runtime beats 98.86 % of python3 submissions
# Your memory usage beats 76.19 % of python3 submissions (13.3 MB)
# @lc code=end


#
# @lc app=leetcode id=125 lang=python3
#
# [125] Valid Palindrome
#

# @lc code=start
class Solution:
    def isPalindrome(self, s: str) -> bool:
        l = 0
        r=len(s)-1
        s=s.lower()
        while l<r:
            while l<r and not s[r].isalnum():
                r-=1
            while l<r and not s[l].isalnum():
                l+=1
            if s[l]!=s[r]:
                return False
            l+=1
            r-=1
        return True
# Your runtime beats 98.86 % of python3 submissions
# Your memory usage beats 76.19 % of python3 submissions (13.3 MB)
# @lc code=end
# # @lc app=leetcode id=125 lang=python3 # # [125] Valid Palindrome # # @lc code=start # Your runtime beats 98.86 % of python3 submissions # Your memory usage beats 76.19 % of python3 submissions (13.3 MB) # @lc code=end