天天看點

[LeetCode]--69. Sqrt(x)

implement int sqrt(int x).

compute and return the square root of x.

我采用的是二分法。每次折中求平方,如果大了就把中值賦給大的,如果小了就把中值賦給小的。