Simple Python Solution


  • 0
    S

    class Solution(object):
    def isPowerOfFour(self, num):
    """
    :type num: int
    :rtype: bool
    """

        if num <= 0:
            return False
        else:
            while num > 1:
                num = float(num)/4
        return num == 1

Log in to reply
 

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