JAVA - Only 6 lines of code very easy solution
Complexity
Time complexity: O(N)

Space complexity: O(1)
Code
****


# Complexity
- Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
public int concatenatedBinary(int n) {
        long res = 0;
        int mod = 1_000_000_007 , size = 0;
        for(int i = 1 ; i <= n ; i++ ){
           if((i & (i - 1)) == 0) size++;
           res =  (res << size | i) % mod;
        }
        return (int)res;
    }
```
['Java']