Concatenation of Consecutive Binary Numbers: Python, One-liner
You can use bin(integer)[2:] or format(integer, \'b\') or f\'{integer:b}\' to get binary string. Then convert it back to int from binary by int(string, 2).\n\nc
You can use `bin(integer)[2:]` or `format(integer, \'b\')` or `f\'{integer:b}\'` to get binary string. Then convert it back to `int` from `binary` by `int(string, 2)`.\n```\nclass Solution:\n    def concatenatedBinary(self, n: int) -> int:\n        return int(\'\'.join([format(x, \'b\') for x in range(1, n + 1)]), 2) % (10**9 + 7)\n```
['Python']