Shawn's Blog

  • Home
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview

Shawn

若有恒,何必三更眠五更起;最无益,莫过一日曝十日寒。
392 posts
13 categories
114 tags

LeetCode 7. Reverse Integer

Posted on 2021-05-04 Edited on 2024-11-24 In LeetCode
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution {
public:
int reverse(int x) {
int rev = 0;
while (x != 0) {
if (rev < INT_MIN / 10 || rev > INT_MAX / 10)
return 0;
rev = rev * 10 + x % 10;
x /= 10;
}
return rev;
}
};
# Math
洛谷 P1046 [NOIP2005 普及组] 陶陶摘苹果
LeetCode 1720. Decode XORed Array
© 2024 Shawn
Powered by Hexo & NexT.Mist
0%