题目:
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
判断一个整数是否是回文数,当他从前读和从后读都一样时。
思路:
太简单了,话不多说,直接上代码。
代码:
class Solution:
def isPalindrome(self, x: int) -> bool:
return str(x) == str(x)[::-1]