Dashboard Temp Share Shortlinks Frames API

HTMLify

Q9_Palidrome_Number.py
Views: 624 | Author: djdj
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class Solution(object):
    def isPalindrome(self, x):
        i = x
        re = 0
        """
        :type x: int
        :rtype: bool
        """
        while x > 0:
            r = x % 10
            re = (re * 10) + r
            x = x//10
        if i == re:
            return 1
        else:
            return 0