Python | O(n) | Pure bit-manipulation without strings | Explanation
Concatenation in binary is analagous to shifting left the overall result by the amount of bits necessary to store the next number to concatenate and then summin
Concatenation in binary is analagous to shifting left the overall result by the amount of bits necessary to store the next number to concatenate and then summing the value. For example:\n```\nresult= 1 = 0b1\nnext_number = 2 = 0b10\n\nresult << 2 => result = 0b100\nresult = result + next_number = 0b100 + 0b10 = 0b110\n```\n\n```python\nclass Solution:\n    def concatenatedBinary(self, n: int) -> int:\n        result = 0\n        MOD = (10**9 + 7)\n        L = 0\n        for num in range(1, n + 1):\n            # Reached a new length. e.g. 1, 10, 100, 1000, etc...\n            # We could also compute the length for every number as math.floor(math.log2(num) + 1)\n            # As per https://en.wikipedia.org/wiki/Bit-length\n            if (num & (num - 1)) == 0:\n                L += 1\n            result = ((result << L) + num) % MOD\n        return result\n```
['Bit Manipulation']