LeetCode_Python3: 9. 回文数(简单)

开始之前:从2018/8/27开始刷LeetCode,计划每周刷五题,周末进行总结并发布在csdn上,计划先刷150道题,从简单开始。

week 1-3


要求:

 CODE:

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

 结果:

补充:

排名第一的代码是用int进行判断提升了速度

猜你喜欢

转载自blog.csdn.net/Kuroyukineko/article/details/82315022