[leetcode] Reverse Integer 反转整数

[leetcode] Reverse Integer 反转整数 

 int reverse(int x) {
       int num = 0;
        while (x != 0) {
            if (abs(num) > INT_MAX / 10) return 0;
            num = num * 10 + x % 10;
            x /= 10;
        }
        return num;
    }

 

相关文章:

  • 2021-10-25
  • 2021-09-11
  • 2021-08-13
  • 2021-11-21
  • 2021-09-30
  • 2021-04-15
  • 2022-12-23
  • 2021-11-03
猜你喜欢
  • 2021-10-10
  • 2021-06-06
  • 2021-08-01
  • 2021-11-25
  • 2022-02-01
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案