Alternating Bits
Return True if the binary form of the positive integer n never has two equal bits next to each other (like 10101), otherwise False.
Example 1
n 5
returns true
101 alternates.
Example 2
n 7
returns false
111 does not.
Constraints
1 <= n <= 2**31 - 1
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.