solution In C++


  • 0
    C

    '''
    class Solution {
    public: int reverse(int x) {
    long int rev = 0;
    while(x != 0)
    {
    rev = rev*10 + x % 10;
    x = x / 10;
    if(rev > INT_MAX || rev < INT_MIN)
    return 0;
    }
    return rev;
    }
    };
    '''


Log in to reply
 

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