Problem Statement | |||||||||||||
A cool number is a non-negative integer that contains at least three consecutive ones or three consecutive zeroes in its binary representation (without leading zeroes). For example, 8 (1000 binary) and 15 (1111 binary) are cool numbers, but 27 (11011 binary) is not. Return the number of cool numbers between lowerBound and upperBound, inclusive. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | upperBound will be between 0 and 2147483647, inclusive. | ||||||||||||
- | lowerBound will be between 0 and upperBound, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|