1 line JAVA Solution From Power Of 3


  • 1
    Y
    public class Solution {
        public boolean isPowerOfFour(int num) {
            return (num > 0) && (Math.pow(4, 15) % num == 0) && ((num & 0x55555555) == num);
        }
    }

Log in to reply
 

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