![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python_leetcode
兰布达
这个作者很懒,什么都没留下…
展开
-
leetcode_9. Palindrome Number(python)
问题:回文数的判断分析:判断一个数是否为回文数,首先先判断正负,如果为负数,那么一定不是回文数,所以我们就只需考虑正数和0。然后借助循环和,将原来的数先取余(%),再整除,依次得到每一位数,最后累加求和,得到翻转过来的数,与原来的数作比较,得到结果。class Solution(object): def isPalindrome(self, x): """ ...原创 2019-04-14 21:41:17 · 105 阅读 · 0 评论 -
leetcode//125. Valid Palindrome
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ if len(s) == 0: return True l = 0 r = len(s...原创 2019-04-18 23:01:34 · 75 阅读 · 0 评论