cpp no loop


  • 0
    P
    class Solution {
    public:
        bool isPowerOfFour(int num) {
            if(num<=0) return false;
            if(num==1) return true;
            int k = (int)sqrt((long long)num+1);
            if(k*k!=num) return false;
            return !(k&(k-1));
        }
    };
    '''

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.