Leetcode刷题——007.整数反转
2024-09-06 05:05:32
上代码:
#include <cmath>
class Solution {
public:
int reverse(int x) { long long temp=;
long long tx=llabs(x); while(abs(tx)>)
{
temp=temp*+tx%; tx=tx/;
}
if (temp> || temp<=-)
{
return ;
}
if (x>)
{
return (int)temp;
}
else
{
return -*(int)temp;
}
}
};
思路:简单
教训:1.<0的整数
2.整数的边界
最新文章
- mysql-proxy 读写分离
- Lucene教程(转)
- Select语句也会引起死锁
- 使用 xtrabackup 进行MySQL数据库物理备份
- ionic cordova 热更新
- Codeforces Round #384 (Div. 2)B. Chloe and the sequence 数学
- C++ Static(静态成员)的作用总结
- C语言 文件操作2--文件缓存的理解
- BZOJ 2754 喵星球上的点名(后缀数组)
- grunt入门之grunt watch的使用
- 【iOS基础学习随笔-1】-基于对象的程序设计
- Codeforces Round #343 (Div. 2) C. Famil Door and Brackets
- C#如何判断质数(转)
- 在微信端使用video标签,播放结束会出现QQ浏览器推荐视频的解决办法(vue)
- Best time to buy and sell stocks IV
- vmware workstation14永久激活密钥分享
- [Luogu3242][HNOI2015]接水果
- 在CentOS 上搭建nginx来部署静态页面网站
- linux编译链接找不到库文件的解决方法。
- 设计模式笔记:策略模式(Strategy)