LeetCode

LeetCode-9 - Palindrome Number

2017-11-14  本文已影响12人  空即是色即是色即是空

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. 有没有办法通过除数/余数就能够完成比较?
上一篇 下一篇

猜你喜欢

热点阅读