Comments (7)
Thanks for pointing this out, I'll check it later.
from leetcode.
signed long long int r=0;
for(;x;x/=10)
r = r*10+x%10;
if(abs(r)>(pow(2,31)-1)) return 0;
else return (int) r;
from leetcode.
@billlipeng
Thanks!
https://oj.leetcode.com/problems/reverse-integer/
#include <math>
class Solution {
public:
int reverse(int x) {
signed long long int result = 0;
for (; x; x/=10)
{
result = result * 10 + x % 10;
}
if (abs(result) > (pow(2, 31)-1)) {
return 0;
} else {
return result;
}
}
};
from leetcode.
+1. The solution is wrong.
from leetcode.
谢谢,我周末抽时间检查一下
from leetcode.
This issue was solved. Plz check my comment on Feb 26, update the code and close it. Thanks a lot!
from leetcode.
同发现问题。我觉得这个解很好。
https://leetcode.com/discuss/51595/short-accepted-c-solution-using-int-without-long-or-string
from leetcode.
Related Issues (20)
- 这个有源码下载吗
- MWE for Codex HOT 1
- 暴力枚举Combinations代码添加cur和k比较条件,可以减少遍历次数
- 闲鱼有人在售卖本书牟利 HOT 1
- 请问有java版本嘛,没有找到java版本的 HOT 1
- qq群已满员。。。请问有2群吗,有好心人拉我进去吗 qq:26799713968
- 希望能出python版本
- 请问有Java版的pdf吗 HOT 2
- Is there a traditional Chinese version? HOT 1
- NumTrees 一题的解法似乎有改进余地
- Regular Expression Matching
- Merge k Sorted Lists
- Symmetric Tree递归算法
- English version of book
- LRU Cache: Not necessary to update cacheMap after splice
- 字体链接失效 HOT 1
- Leetcode Java Sqrt(x) 题代码错误 HOT 1
- 15.1 为啥要用long long?
- 2.1.18 第30页勘误
- Python version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leetcode.