Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.
Input: 5
Output: true
Explanation:
The binary representation of 5 is: 101
Input: 7
Output: false
Explanation:
The binary representation of 7 is: 111.
Input: 11
Output: false
Explanation:
The binary representation of 11 is: 1011.
Input: 10
Output: true
Explanation:
The binary representation of 10 is: 1010.