2023-09-20 16:07:10 +0000 UTC

Power of Two

Code

class Solution:
    def isPowerOfTwo(self, n: int) -> bool:
        return n > 0 and n & (n - 1) == 0