1 line C++ solution with logarithm


  • 0
    J
    class Solution {
    public:
        bool isPowerOfFour(int num) {
            return (int)(log(num*1.0) / log(4.0)) == log(num*1.0) / log(4.0);
        }
    };
    

Log in to reply
 

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