Giving Run time Error. Please help


  • 0
    N

    int count=32,p=1<<31;
    if(m==n)
    return m;
    while(1)
    {
    if(p&m==0 && p&n!=0)
    break;
    p=p>>1;
    count--;
    }
    int x=32-count;
    p=0;
    while(x!=0)
    {
    p=p<<1;
    p=p|1;
    x--;
    }
    p=p<<count;
    return p&m;


Log in to reply
 

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