leetcode python
来源:互联网 发布:农村淘宝官方下载 编辑:程序博客网 时间:2024/06/11 05:46
# Reverse digits of an integer.## Example1: x = 123, return 321# Example2: x = -123, return -321## click to show spoilers.## Note:# The input is assumed to be a 32-bit signed integer.# Your function should return 0 when the reversed integer overflows.class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ res = 0 flag = x < 0 and -1 or 1 x *= flag while x != 0: res = res * 10 + x % 10 x /= 10 if res > 2147483647: return 0 return res * flag
0 0
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- leetcode python
- [leetcode: Python]
- 【LeetCode with Python】 Permutations
- Leetcode Python Palindrome Number
- LeetCode-Sort List(Python)
- 【LeetCode with Python】 Subsets
- [leetcode]LRU Cache (python)
- 【leetcode】Reorder List (python)
- 【leetcode】Candy(python)
- 【leetcode】Clone Graph(python)
- linux 下进入xampp中mysql
- C++第三次作业
- 浅析CDN技术与安全
- NYOJ1248_海岛争霸
- Cartographer记录
- leetcode python
- 进程小总结
- Windows Android Studio安装图文教程
- OJ 1096: 字符逆序
- 混合APP开发的套路(四):在html页面中打开项目中的Activity
- 归并排序&归并排序求逆序对
- 17-4-5 getElemntsClass()[]
- Python中使用@staticmethod 和 @classmethod 装饰器
- iar for stm32建立工程时添加自带库的问题