Created
October 6, 2024 17:32
-
-
Save mohneesh7/da76d851ef0edc477bf06a24307651e8 to your computer and use it in GitHub Desktop.
Solution for Valid Palindrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Solution for Valid Palindrome | |
| class Solution: | |
| def isPalindrome(self, s: str) -> bool: | |
| s = s.lower() | |
| s_list = list(s) | |
| s = ''.join([x for x in s_list if x.isalnum()]) | |
| return s == s[::-1] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment