KTH Root Problem


Why I am getting ans=32 ??

You should store ans=mid when n>pow(mid,k)