Simple PYTHON - 98%


  • 0
    V
    class Solution(object):
        def isPowerOfFour(self, num):
            """
            :type num: int
            :rtype: bool
            """
            if num == 0: return False
            
            while num != 1:
                if num % 4 != 0:
                    return False
                num /= 4
            
            return True
    

Log in to reply
 

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