当前位置: 代码迷 >> 综合 >> 367 https://leetcode-cn.com/problems/valid-perfect-square/
  详细解决方案

367 https://leetcode-cn.com/problems/valid-perfect-square/

热度:66   发布时间:2023-10-13 02:39:55.0
class Solution {
    
public:bool isPerfectSquare(int num) {
    int subNum = 1;while (num > 0) {
    num -= subNum;subNum += 2;}return num == 0;}
};
  相关解决方案