[c++][Beginner friendly][easy understanding]
\n#define mod 1000000007\nclass Solution {\npublic:\n    \n    int concatenatedBinary(int n) {\n        string s=decimalToBinary(n);\n        return binaryToDec
```\n#define mod 1000000007\nclass Solution {\npublic:\n    \n    int concatenatedBinary(int n) {\n        string s=decimalToBinary(n);\n        return binaryToDecimal(s);\n    }\n\t\n\tstring decimalToBinary(int n) { \n         string str="";\n        for(int i=n;i>=1;--i){\n            int no=i;\n            while(no){\n                str+=(no%2)+\'0\';\n                no/=2;\n            }\n        }\n        return str;\n    } \n    \n    int binaryToDecimal(string n){\n        long long ans=0,powe=1;\n        for(int j=0;j<n.size();++j){\n                long long now=(n[j]-\'0\')*(powe);\n                powe*=2;\n                powe%=mod;\n                ans+=now;\n        }\n        return ans%mod;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']