难度: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都不行,原因至今未知。
难度: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都不行,原因至今未知。
相关文章: