You are given an integer n.
An integer is called Monobit if all bits in its binary representation are the same.
Return the count of Monobit integers in the range [0, n] (inclusive).
Example 1:
Input: n = 1
Output: 2
Explanation:
[0, 1] have binary representations "0" and "1".Example 2:
Input: n = 4
Output: 3
Explanation:
[0, 4] include binaries "0", "1", "10", "11", and "100".
Constraints:
0 <= n <= 1000Solutions for this problem are being prepared.
Try solving it yourselfPractice Count Monobit Integers with our built-in code editor and test cases.
Practice on FleetCode