✅✅Faster || Easy To Understand || C++ Code
Bit Manipulation\n\n Time Complexity :- O(NlogN)\n\n Space Complexity :- O(N)\n\n\nclass Solution {\npublic:\n    int concatenatedBinary(int n) {\n        \n   
* ***Bit Manipulation***\n\n* ***Time Complexity :- O(NlogN)***\n\n* ***Space Complexity :- O(N)***\n\n```\nclass Solution {\npublic:\n    int concatenatedBinary(int n) {\n        \n        long long mod = 1e9 + 7;\n        \n        long long res = 0;\n        \n        for(int i = 1; i <= n; i++)\n        {\n            // find the length of curr num\n            \n            int len = 0;\n            \n            int num = i;\n            \n            while(num)\n            {\n                len++;\n                \n                num = num >> 1;\n            }\n            \n            // left shift the res by len\n            \n            res = (res << len) % mod;\n            \n            // add the curr num to the res\n            \n            res = (res % mod + i % mod) % mod;\n        }\n        \n        return res % mod;\n    }\n};\n```
['Bit Manipulation', 'C', 'C++']