# LeetCode OJ(7.Reverse Integer)

Reverse digits of an integer.

Example1: x = 123, return 321
Example2: x = -123, return -321

class Solution {
public:
int reverse(int x) {
long long sum = 0, temp;
int maxint = 0x7fffffff;
int minint = 0x80000000;
if (x >= maxint && x <= minint)
return 0;
else
{
while (x != 0)
{
temp = x % 10;
sum = sum * 10 + temp;
sum = sum > maxint ? 0 : sum;
sum = sum < minint ? 0 : sum;
x = x / 10;

}
}

return sum;

}
};


#### Leetcode 7 Reverse Integer 反转数字

2015-04-20 10:28:58

#### leetcode 7. Reverse Integer（C语言，翻转一个整数，判断是否溢出）19

2017-10-01 21:04:41

#### Leetcode-8-String to Integer(atoi) C++

2016-06-27 14:24:44

#### String to Integer (atoi) -- LeetCode

2014-03-16 00:55:41

#### 【Leetcode】7.Reverse Integer 解题

2016-04-18 02:49:32

#### leetcode 7.reverse integer

2017-10-11 13:02:40

#### 【LeetCode】7.Reverse Integer

2016-03-20 16:08:22

#### leetcode 7.Reverse Integer

2016-06-18 18:31:39

#### LEETCODE 7.Reverse Integer

2016-09-09 00:23:43

#### LeetCode 7.Reverse Integer

2015-02-02 16:58:06