bool isPerfectSquare(int num) {
int n = 1;
while (num > 0)
num -= n, n += 2;
return num == 0;
}
367. 有效的完全平方数
最新推荐文章于 2022-06-28 15:50:34 发布
bool isPerfectSquare(int num) {
int n = 1;
while (num > 0)
num -= n, n += 2;
return num == 0;
}