# Leetcode 693 - Binary Number with Alternating Bits

`Note:`

- Use
`& 1`

to get the least significant bit. - Use
`lastBit`

to preserve last bit. - Note that
`&`

has a lower priority than`===`

.

`Question:`

Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.

`Example:`

1 | Input: n = 5 |

`Code:`

1 | /** |