My Solution without loop


  • 0
    H
    public class Solution {
        public boolean isPowerOfFour(int num) {
                 if (num <= 0)
            return false;
        double r = Math.log10(num) / Math.log10(4);
        
        if (r % 1 == 0)
            return true;
        else
            return false;
        
        }
    }

Log in to reply
 

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