#3827

Count Monobit Integers

pupil · 335 · lc easy +22 · 66.1% accepted · 50 likes · top 71%

Description

Given an integer n, a positive integer is called Monobit when every bit in its binary representation is identical (all 0s or all 1s). Return the total count of Monobit integers in the inclusive range [0, n].

Code

1
2
3