simple and quick python code (4 lines)


  • 0
    J

    idea:
    convert input_int to string
    check whether reversed_version == input_str

        def isPalindrome(self, x):
            x=str(x)
            mirror_x=x[::-1]
            if mirror_x ==x: return True
            else: return False
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.