您的位置:首页 > 其它

leetcode69---Sqrt(x)

2017-12-02 20:53 555 查看
难度:easy

Implement 
int sqrt(int x)
.

Compute and return the square root of x.

x is guaranteed to be a non-negative integer



思路: 两分法,看了很多code,貌似每次缩小范围的时候,都是low=mid +1,试过high =mid -1 或者 low =mid都不行,原因至今未知。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  leetcode binary search