class Solution {
public int mySqrt(int x) {
long l = 0;
long r = x;
while(l<r){
long mid = l + r + 1 >> 1;
if(mid*mid<=x){
l = mid;
}else{
r = mid - 1;
}
}
return (int)l;
}
}
原文:https://www.cnblogs.com/vccyb/p/13730944.html