Runtime: 56 ms beats 95.94 % of python3 submissions.


  • 0
    M

    Runtime: 56 ms beats 95.94 % of python3 submissions.

    class Solution:
        def isPowerOfFour(self, n):
            """
            :type n: int
            :rtype: bool
            """
            if n < 1:
                return False
            if n in [1, 4]:
                return True
            if n % 4:
                return False
            return self.isPowerOfFour(n // 4)
    

Log in to reply
 

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