from typing import List


class Solution:
    def hasAlternatingBits(self, n: int) -> bool:
        b = bin(n)[2:]
        N = len(b)
        if N < 2:
            return True
        for i in range(N-1):
            if b[i] == b[i+1]:
                return False
        return True


if __name__ == "__main__":
    s = Solution()
    result = s.hasAlternatingBits(11)
    print(result)

bbc54c5ca26d142f8651615551b2b9c7fa99c158
<mask token>


class Solution:
    <mask token>


<mask token>

<mask token>


class Solution:

    def hasAlternatingBits(self, n: int) ->bool:
        b = bin(n)[2:]
        N = len(b)
        if N < 2:
            return True
        for i in range(N - 1):
            if b[i] == b[i + 1]:
                return False
        return True


<mask token>

<mask token>


class Solution:

    def hasAlternatingBits(self, n: int) ->bool:
        b = bin(n)[2:]
        N = len(b)
        if N < 2:
            return True
        for i in range(N - 1):
            if b[i] == b[i + 1]:
                return False
        return True


if __name__ == '__main__':
    s = Solution()
    result = s.hasAlternatingBits(11)
    print(result)

from typing import List


class Solution:

    def hasAlternatingBits(self, n: int) ->bool:
        b = bin(n)[2:]
        N = len(b)
        if N < 2:
            return True
        for i in range(N - 1):
            if b[i] == b[i + 1]:
                return False
        return True


if __name__ == '__main__':
    s = Solution()
    result = s.hasAlternatingBits(11)
    print(result)

from typing import List


class Solution:
    def hasAlternatingBits(self, n: int) -> bool:
        b = bin(n)[2:]
        N = len(b)
        if N < 2:
            return True
        for i in range(N-1):
            if b[i] == b[i+1]:
                return False
        return True


if __name__ == "__main__":
    s = Solution()
    result = s.hasAlternatingBits(11)
    print(result)
