Alternating Bits Check

Check whether a positive integer has alternating bits in its binary representation, meaning no two adjacent bits are the same. Return true if the pattern alternates, false otherwise.

Examples
Input: 5
Output: true
Hints

Alternating Bits Check

Check whether a positive integer has alternating bits in its binary representation, meaning no two adjacent bits are the same. Return true if the pattern alternates, false otherwise.