Advertisement
Guest User

Untitled

a guest
Apr 6th, 2022
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. class Solution {
  2.     public int reverse(int x) {  
  3.         int res = 0;
  4.         while (x != 0)
  5.         {
  6.             if (res > 214748364 || res < -214748364)
  7.                 return 0;
  8.             res = res * 10 + x % 10;
  9.             x /= 10;
  10.         }  
  11.         return res;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement