problem
code
class Solution { public: int mySqrt(int x) {// x/b=b long long res = x;// while(res*res > x) { res = (res + x/res) / 2;// } return res; } };
重点在于理解怎么计算平方根。
The key point is the average result is calculate by "ans = (ans + x / ans) / 2";
参考
完