[勇者闯LeetCode] 9. Palindrome Number
来源:互联网 发布:php实现sql防注入 编辑:程序博客网 时间:2024/04/29 07:17
[勇者闯LeetCode] 9. Palindrome Number
Description
Determine whether an integer is a palindrome. Do this without extra space.
Information
- Tags: Math
- Difficulty: Easy
Solution
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0 or (x != 0 and x % 10 == 0): return False a, b = 0, x while b > a: a, b = a * 10 + b % 10, b // 10 return a == b or a // 10 == b
0 0
- [勇者闯LeetCode] 9. Palindrome Number
- [勇者闯LeetCode] 125. Valid Palindrome
- [勇者闯LeetCode] 136. Single Number
- [勇者闯LeetCode] 191. Number of 1 Bits
- [勇者闯LeetCode] 129. Sum Root to Leaf Number
- [勇者闯LeetCode] 69. Sqrt(x)
- [勇者闯LeetCode] 1. Two Sum
- [勇者闯LeetCode] 7. Reverse Integer
- [勇者闯LeetCode] 13. Roman to Integer
- [勇者闯LeetCode] 14. Longest Common Prefix
- [勇者闯LeetCode] 20. Valid Parentheses
- [勇者闯LeetCode] 100. Same Tree
- [勇者闯LeetCode] 27. Remove Element
- [勇者闯LeetCode] 28. Implement strStr()
- [勇者闯LeetCode] 35. Search Insert Position
- [勇者闯LeetCode] 38. Count and Say
- [勇者闯LeetCode] 6. ZigZag Conversion
- [勇者闯LeetCode] 53. Maximum Subarray
- Java中keySet()返回值的排序问题
- 浅谈对三层和实体层的认识
- 【NDN安全】Interest Flooding Attack and Countermeasures in Named Data Networking 学习笔记
- webserive实践
- 为什么hashcode()和equals()方法要一起重写
- [勇者闯LeetCode] 9. Palindrome Number
- 面试中问到的Java IO中涉及到哪些设计模式
- jekins 发送邮件设置(转)
- Python面向对象编程(4)——类的继承与方法重载
- 几种常见的激活函数
- NIO
- 使用AppBarLayout注意事项
- chrome非常好用的图片放大插件 Imagus
- #include <windows.h> 为什么不能放在 #include <tlhelp32.h> 后面