[Leetcode从零开刷]7. Reverse Integer
来源:互联网 发布:栅格数据是什么意思 编辑:程序博客网 时间:2024/05/20 02:24
题目来源leetcode
Given a 32-bit signed integer, reverse digits of an integer.
For example:
翻译:
给一个32位的无符号整数,反转整数的数字。
解题:利用取余和取除数的方法,一个整数一个整数的求。
没有考虑越界的问题,见答案上用到了另外一个语句。
return (res<INT_MIN || res>INT_MAX) ? 0 : temp;
cpp:
class Solution {public: int reverse(int x) { long long temp=0; while(x) { temp =temp*10 + x%10; x /=10; } return temp; } };
阅读全文
0 0
- [Leetcode从零开刷]7. Reverse Integer
- [LeetCode]7.Reverse Integer
- LeetCode 7. Reverse Integer
- LeetCode --- 7. Reverse Integer
- LeetCode 7.Reverse Integer
- [Leetcode] 7. Reverse Integer
- [Leetcode]7.Reverse Integer
- LeetCode 7.Reverse integer
- [LeetCode] 7.Reverse Integer
- 7. Reverse Integer LeetCode
- leetcode 7. Reverse Integer
- leetcode 7. Reverse Integer
- leetcode 7. Reverse Integer
- Leetcode 7. Reverse Integer
- 【LeetCode】7.Reverse Integer
- LeetCode 7. Reverse Integer
- LeetCode *** 7. Reverse Integer
- LeetCode 7. Reverse Integer
- FPGA跨时钟域处理数据总结
- C 注释
- linux下IPTABLES配置详解
- 数字排序 o(n)时间 o(1)空间
- 类的中介的使用方法
- [Leetcode从零开刷]7. Reverse Integer
- 日文IT词汇的中文翻译
- elasticSearch安装常见错误或问题
- PHP学习(9)-Email
- LINUX 查看CPU信息
- Activity详解(生命周期、以各种方式启动Activity、状态保存,完全退出等)
- angularJS自定义指令各配置项详解
- 简易上传图片原生input-file实现方案
- python 绘制 Caffe 的trainloss testloss testaccuracy 曲线