C++ Super Simple, Short and Easy O(n) Solution
\nclass Solution {\npublic:\n    int concatenatedBinary(int n) {\n        long res = 0, mod = 1e9+7, len_of_curr = 0;\n        for (int i = 1; i <= n; i++) {\n\
```\nclass Solution {\npublic:\n    int concatenatedBinary(int n) {\n        long res = 0, mod = 1e9+7, len_of_curr = 0;\n        for (int i = 1; i <= n; i++) {\n\t\t\n\t\t\t// the len increases every time we reach a number which is a power of two.\n            if ((i & (i-1)) == 0)\n                len_of_curr++;\n\t\t\t\t\n            res = (res << len_of_curr) % mod;\n            res += i % mod;\n        }\n        return res;\n    }\n};\n```\n**Like it? please upvote...**
['C']