Java recursive solution


  • 0
    public class Solution {
        public boolean isPowerOfFour(int num) {
            if(num == 0) return false;
            if(num % 4 != 0)return num == 1;;
            return isPowerOfFour(num/4);
        }
    }
    

Log in to reply
 

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