class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if str(x)[::-1] == str(x):
return True
return False
leetcode - 9 - 回文数
最新推荐文章于 2022-05-31 20:06:09 发布
本文介绍了一种简单有效的算法,用于判断一个整数是否为回文数。通过将整数转换为字符串并进行反转比较,该算法能够快速确定输入整数是否与其反转后的形式相同。
501

被折叠的 条评论
为什么被折叠?



