这道题,我先测试了下c++标准数学库,嗯,did it work!!!
而且效率还可以,不像pow的那道题,死慢
class Solution {
public:
int mySqrt(int x) {
return sqrt(x);
}
};
Runtime: 4 ms, faster than 75.96% of C++ online submissions for Sqrt(x).
Memory Usage: 8.2 MB, less than 98.25% of C++ online submissions for Sqrt(x).