✅Short || C++ || Explained Solution✔️ || Beginner Friendly ||🔥 🔥 BY MR CODER
Watch this video \uD83E\uDC83 for the better explanation of the code.\n\nhttps://www.youtube.com/watch?v=yMwSJfpSYEo\n\nAlso you can SUBSCRIBE \uD83E\uDC81 \uD8
**Watch this video \uD83E\uDC83 for the better explanation of the code.**\n\nhttps://www.youtube.com/watch?v=yMwSJfpSYEo\n\nAlso you can SUBSCRIBE \uD83E\uDC81 \uD83E\uDC81 \uD83E\uDC81 this channel for the daily leetcode challange solution.\nhttps://t.me/dsacoder \u2B05\u2B05 Telegram link to discuss leetcode daily questions and other dsa problems\n**C++**\n```\nclass Solution {\npublic:\n    int concatenatedBinary(int n) {\n        long ans = 0, mod = 1e9+7, length = 0;\n        for (int i = 1; i <= n; ++i) {\n            \n            if ((i & (i - 1)) == 0) length++;\n            ans = ((ans << length) + i) % mod;\n        }\n        return ans;\n    }\n};\n```\n**Please do UPVOTE to motivate me to solve more daily challenges like this !!**
['C', 'C++']