leetcode

作者: ThomasAAnderson | 来源:发表于2019-08-13 11:43 被阅读0次

9. 回文数

判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。

class Solution(object):

    def isPalindrome(self, x):

        z = str(x)

        return z[::-1] == z

相关文章

网友评论

    本文标题:leetcode

    本文链接:https://www.haomeiwen.com/subject/erdvjctx.html