solution java


  • 0
    W

    class Solution {
    public int reverse(int x) {
    double n=0;
    while(x!=0){
    int m=x%10;
    x/=10;
    n=n*10+m;
    }

    if(n>Integer.MAX_VALUE){
           return 0;
    }else if(n<Integer.MIN_VALUE){
            return 0;
     }
        
       return (int)n;
    }
    

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.