# 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。
# 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。
# def isPalindrome(x):
# """
# :type x: int
# :rtype: bool
# """
# if x < 0:
# return False
# else:
# if str(x) == str(x)[::-1]:
# return True
# else:
# return False
"""
事实上
"""
# def isPalindrome(x):
# return str(x)[::-1] == str(x) # 自动返回True或False
LeetCode2021.3.11-回文数
最新推荐文章于 2025-06-02 14:28:44 发布