2025-08-15 08:52:01 +0000 UTC
Power of Four
Categories:
Links
Code
class Solution:
def isPowerOfFour(self, n: int) -> bool:
if n <= 0:
return False
if n & (n - 1) != 0:
return False
while n % 4 == 0:
n //= 4
return n == 1