Last active
February 27, 2020 22:02
-
-
Save BharathKumarS/ed606b6b10b730438fd25838b51deb22 to your computer and use it in GitHub Desktop.
LeetCode, Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
This file contains 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
#This solution works only when executed on LeetCode. For test cases and practice, check my git repo | |
class Solution: | |
def isPalindrome(self, x: int) -> bool: | |
rev = '' | |
for char in str(x)[::-1]: | |
rev = rev + char | |
if str(x) == rev: | |
return(True) | |
else: | |
return(False) |
Author
BharathKumarS
commented
Feb 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment