can anyone tell all the different ways to check the constraint without using long or unsigned

  • 0

    I know we can use long and unsigned int,are there any other ways except this
    public int reverse(int x)
    int ans = 0,temp;
    while (x!=0) {
    temp=ans*10 + (x%10);
    if(temp/10 !=ans) return 0;
    return ans;

Log in to reply

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