leetcode9-会文数

方法一:转化为字符串,然后反转 

class Solution:
    def isPalindrome(self, x):
        """
        :type x: int
        :rtype: bool
        """
        if x<0:
            return False
        else:
            x=str(x)
            y=x[::-1]
            if x==y:
                return True
            else:
                return False

 

相关文章:

  • 2021-09-30
  • 2022-12-23
  • 2021-07-02
  • 2022-01-13
  • 2021-12-26
  • 2021-06-11
  • 2021-09-29
  • 2022-12-23
猜你喜欢
  • 2021-04-18
  • 2022-12-23
  • 2021-09-06
  • 2021-06-14
  • 2021-12-22
  • 2021-08-26
  • 2021-12-01
相关资源
相似解决方案