C++ Solution to Coding Challenge 1680. Concatenation of Consecutive Binary Numbers
Bit manipulation, mathematics and recursion
Problem statement
Given an integer n
, return the decimal value of the binary string formed by concatenating the binary representations of 1
to n
in order, modulo 10^9 + 7
.