2ms one line solution in Java


  • 0
    J
    public boolean isPowerOfFour(int num) {
        return (num>0 && (num & (num-1))==0 && (Math.log(num)/Math.log(2))%2==0);    
    }

Log in to reply
 

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