LeetCode 9.回文数(简单)

python

class Solution:
    def isPalindrome(self, x: int) -> bool:
        str1 = str(x)
        str2 = str1[::-1]
        if(str1 == str2):
            return True
        return False

LeetCode 9.回文数(简单)_第1张图片

 

你可能感兴趣的:(LeetCode刷题,leetcode,算法,职场和发展)