LeetCode-9 - Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.

Solution

class Solution(object):
    def isPalindrome(self, x):
        """
        :type x: int
        :rtype: bool
        """
        
        return str(x) == str(x)[::-1]

思考

  1. 有没有办法通过除数/余数就能够完成比较?

你可能感兴趣的:(LeetCode-9 - Palindrome Number)