2023-09-20 15:32:34 +0000 UTC

Power of Four

Code

class Solution:
    def isPowerOfFour(self, n: int) -> bool:
        return n and not (n & (n - 1)) and (n & 0x55555555)