Loading

LeetCode 70 X的平方和

LeetCode 70 X的平方和

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;

    }
}
posted @ 2020-09-25 16:22  想用包子换论文  阅读(114)  评论(0)    收藏  举报