We’re preparing your current view and syncing the latest data.
Given an integer n, consider the binary representations of the numbers from 1 to n concatenated in order. For example, if n = 3, the binary strings are '1', '10', '11'. Their concatenation is '11011'. Return the decimal value of this concatenated binary string modulo 10^9 + 7.
An integer n representing the range from 1 to n.
Return an integer representing the concatenated binary numbers from 1 to n, interpreted as a binary number, modulo 10^9 + 7.
1 <= n <= 10^5