当前位置:网站首页>力扣刷题7. 整数反转
力扣刷题7. 整数反转
2022-07-20 02:08:00 【grt要一直一直努力呀】
class Solution {
public int reverse(int x) {
//res代表最后反转返回的数字
int res = 0;
while(x!=0){
int temp = x%10;//循环取出最后一位数
if(res>214748364 || (res==214748364&&temp>7)){
return 0;
}
if(res<-214748364 ||(res == -214748364&&temp<-8)){
return 0;
}
res = res*10+temp;
x=x/10;
}
return res;
}
}
边栏推荐
- Tutorial on principles and applications of database system (027) -- MySQL modifying data in tables (III): update
- 洛谷 P1873 [COCI 2011/2012 #5] EKO / 砍树 二分
- 消息队列——消息队列入门
- Tutorial on principles and applications of database systems (029) -- data integrity of MySQL (II): defining primary keys
- JSON【代码演示详解,带你精通 JSON】
- Tutorial on principles and applications of database system (023) -- Summary of various methods of creating data tables in MySQL
- Detailed explanation of program environment and pretreatment
- QT_ Embedded main interface addition and switching effect
- Xtrabackup realizes MySQL: full backup + incremental backup
- 3 种缓存更新策略是怎样的?
猜你喜欢
ViT【backbone】
類和對象(上)
Difficulties and solutions of project management in complete electrical equipment manufacturing enterprises
Day106.尚医通:数据字典列表、EasyExcel、数据字典导入导出、集成Redis缓存
一文搞懂MySQL架构设计,再也不用担心面试官问得太深
机器学习练习 8 -异常检测和推荐系统(协同过滤)
Understand the MySQL architecture design in one article, and don't worry about the interviewer asking too much
自定义类型:结构体,枚举,联合
通过TCP方式点灯
Kubernetes Kube scheduler
随机推荐
acwing 872. 最大公约数
已解决No module named ‘flask_misaka‘【BUG解决】
LeetCode_ 90_ Subset II
Learn about spark project on nebulagraph
How to recover the lost database password?
[swpu2019] web1-1 | SQL injection
二值化神经网络权重的分布规则
QT_ QSS file easy-to-use tutorial
Leetcode exercises grammar supplementary summary notes
Xtrabackup realizes MySQL: full backup + incremental backup
动态内存管理
acwing 870. 约数个数
Iptables prevent nmap port scanning
数据库系统原理与应用教程(028)—— MySQL 的数据完整性(一):数据完整性概述
数据库系统原理与应用教程(029)—— MySQL 的数据完整性(二):定义主键(primary key)
acwing 867. 分解质因数
裕华万宝风扇安装顺序
Introduction to audio and video -- Analysis of H.264 coding (macroblock + slice + frame)
数据库系统原理与应用教程(030)—— MySQL 的数据完整性(三):定义 UNIQUE 约束
数据库系统原理与应用教程(026)—— MySQL 修改表中数据(二):删(delete from)