Kth root problem

ans for 2nd case is not coming.

Use these additions, along with your code you have written ,
mid = (beg+end)/2;
if( pow(mid,k) == N)
{
x = mid;
break;
}
else if( pow(mid,k) <N)
{
x= mid;
beg = mid+1;

    }
    else if( pow(mid,k) > N)
    {
       end = mid-1;
    }
}

still it is not working for large inputs, for shorter one it is working fine.

Send your code by saving on ide, I will make necessary changes.

I have made necessary changes in your code, refer to it,

1 Like