Given an integer n, return true if the binary representation of n contains exactly 111 adjacent pair of set bits (111s), and false otherwise.
n
true
false
Constraints:
0≤0 \leq0≤ n ≤105\leq 10^5≤105
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Exactly One Consecutive Set Bits Pair
For the input 0, what should the function return?
0
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Implement your solution in the following coding playground.