Java Solution Using MIN_VALUE


  • 0
    Y
     public boolean isPowerOfTwo(int n) {
            if(n<=0) return false;
            return(Integer.MIN_VALUE%n==0);
        }
    
    

Log in to reply
 

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