LeetCode_Palindrome Number

Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
(判断数字是否是回文序列)

Example:



字符串翻转

1
2
3
4
5
6
7
8
9
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
string = str(x)

return string == string[::-1]