Skip to content

Instantly share code, notes, and snippets.

@BharathKumarS
Last active February 27, 2020 22:02
Show Gist options
  • Save BharathKumarS/ed606b6b10b730438fd25838b51deb22 to your computer and use it in GitHub Desktop.
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 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)
@BharathKumarS
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment