Implement int sqrt(int x).
Compute and return the square root of x.
很简单的题:
class Solution {
public:
int mySqrt(int x) {
return int(sqrt(x));
}
};
本文介绍了一个简单的C++类实现,该类能够计算并返回给定整数x的平方根。通过使用sqrt函数进行计算,该解决方案简洁且高效。
Implement int sqrt(int x).
Compute and return the square root of x.
很简单的题:
class Solution {
public:
int mySqrt(int x) {
return int(sqrt(x));
}
};
374

被折叠的 条评论
为什么被折叠?