342. Power of Four
# Easy
class Solution:
def isPowerOfFour(self, num: int) -> bool:
if num < 0:
return False
if num & (num-1) != 0:
return False
if (num-1)%3 != 0:
return False
return True
Last updated
Was this helpful?