Python: using bin() and int() functions
\n\nclass Solution:\n    def concatenatedBinary(self, n: int) -> int:\n        stp = ""\n        for i in range(0, n+1):\n            stp +=bin(i)[2:]\n        
\n```\nclass Solution:\n    def concatenatedBinary(self, n: int) -> int:\n        stp = ""\n        for i in range(0, n+1):\n            stp +=bin(i)[2:]\n        return int(stp, 2) % (10**9 + 7)\n```\n\nUpdated Code :\n```\nclass Solution:\n    def concatenatedBinary(self, n: int) -> int:\n        stp = []\n        for i in range(0, n+1):\n            stp.append(bin(i)[2:])\n        stp = "".join(stp)\n        return int(stp, 2) % (10**9 + 7)\n```
[]