Python || Bit Manipulation || O(N) || Easy to Understand
suppose we have two integers A and B with binary(a1,a2,..,an) and (b1,b2,..,bm) and we need to add the binary of both the digits\nthen what we can do is shift t
suppose we have two integers A and B with binary(a1,a2,..,an) and (b1,b2,..,bm) and we need to add the binary of both the digits\nthen what we can do is shift the bits of A to the left side m times which is the length of the second integer and add the second integer to the value  like : ` A<<m + B`\n\nfor example A = 1 and B = 2 the binary representaions will be 1 and 10\nto add A and B binary strings we will have do a leftshift operation 2 times on 1(bin - 1) and the result will be 4(bin -100) and after that we will add 2 to the result that will  be 6(bin - 110)\n\nfor this particular problem we can keep track of number of digits in B like if B is a power of 2 then we will increase number of digits \n\nif a number n is a power of 2 then the value n&(n-1) will always be 0 because there will be no matching set bits in n and (n-1) numbers\n\n\n\n```\n\nclass Solution:    \n    def concatenatedBinary(self, n: int) -> int:\n\t    mod = 10**9 + 7\n        digitsToLeftShift = 1                                #  number of digits to leftshift\n        curr = 1                                                   #  current value to return\n        for i in range(2,n+1):\n            if not i&(i-1):                                       #  if i is power of 2 then increment digits to leftshift\n                digitsToLeftShift += 1\n            curr = ((curr<<digitsToLeftShift) + i) % mod     # append the binary and assign to curr\n        return curr\n      \n\t \n\t Time Complexity : O(N)\n\t Space Complexity: O(1)\n\t \n```\n\t \n\t \n\t \n![image](https://assets.leetcode.com/users/images/ce9a97d0-3439-4c0f-99d2-34a368859233_1663915498.0950859.png)\n\n\n
['Bit Manipulation', 'Python']