One line c++ solution


  • 0
    M
    class Solution {
    public:
        bool isPowerOfFour(int num) {
            return (num > 0) && ((num & (-num)) == num) && ((int)log2(num) % 2 == 0);
        }
    };
    

Log in to reply
 

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