Easiest Solution | C++


#1

int Solution::sqrt(int A) {
long long l=1,h=A,mid;
while(l<=h)
{
mid=l+(h-l)/2;
if(midmid==A)
{
return mid;
}
else if(mid
mid>A)
{
h=mid-1;
}
else
{
l=mid+1;
}
}
return h;
}