Skip to content

342 Power of Four

342. Power of Four

题目: https://leetcode.com/problems/power-of-four/

难度 : Easy

继续照抄power of three

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



回到顶部