Concatenation of Consecutive Binary Numbers
Medium · Bit Manipulation · about 20 minutes
Asked at Amazon, Google, Microsoft.
Concatenate the binary representations of 1..n in order and return the decimal value of the resulting binary string modulo 10⁹ + 7.