Search
⌘K

Leetcode 1680. Concatenation of Consecutive Binary Numbers

Return the decimal value (mod 1e9+7) of the binary string formed by concatenating the binary representations of 1..n. The core challenge is to do this efficiently by appending each number using shifts/multiplication by 2^{bit-length} (bit-lengths increase at powers of two) rather than building the full string, with n up to 1e5.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.