C++ | Solution | Easy to understand
\t#Please upvote, It it is helpful :)\n\tclass Solution {\n\tpublic:\n\t\tint concatenatedBinary(int n) {\n\t\t\tlong long ans = 0;\n\t\t\tint M = 1e9+7;\n\t\t\
\t#Please upvote, It it is helpful :)\n\tclass Solution {\n\tpublic:\n\t\tint concatenatedBinary(int n) {\n\t\t\tlong long ans = 0;\n\t\t\tint M = 1e9+7;\n\t\t\tstring num = "";\n\t\t\t// concatinating the numbers\n\t\t\tfor(int i = n; i >= 1; i--)\n\t\t\t{\n\t\t\t\tint t = i;\n\t\t\t\twhile(t)\n\t\t\t\t{\n\t\t\t\t\tnum += t%2 + \'0\';\n\t\t\t\t\tt /= 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// evaluating num\n\t\t\tint pow = 1;\n\t\t\tfor(int i = 0; i < num.size(); i++)\n\t\t\t{\n\t\t\t\tlong long t = (num[i]-\'0\')*pow;\n\t\t\t\tpow *= 2;\n\t\t\t\tpow %= M;\n\t\t\t\tans += t;\n\t\t\t\tans %= M;\n\t\t\t}\n\t\t\treturn ans%M;\n\t\t}\n\t};
['C', 'Iterator', 'C++']