java and easy to understand


  • 0
    H

    public class Solution {
    public boolean isPowerOfFour(int num) {
    if(num==0){
    return false;
    }
    Integer i=new Integer(num);
    String binary=Integer.toBinaryString(i);
    if(binary.indexOf("1", 1)==-1 && binary.length()%2 != 0){
    return true;
    }
    return false;
    }
    }


Log in to reply
 

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