Concise and easy js solution with explanation O(N)
Main idea: What concatenating actually does is, to shift the origin values to the left and then plus the new values.\n\nFor example: 2 concat 3 = 10 concat 11 =
Main idea: What concatenating actually does is, to shift the origin values to the left and then plus the new values.\n\nFor example: 2 concat 3 = 10 concat 11 => 10 shift 2 bits then add 11 = 1011.\n\nAlso: \n1. Shifting n bits is equal to mulitply by 2 ** n. \n2. For i that 2 ** (n-1) <= i < 2 ** n we shift the same number of bits n.\n\nSo now the coding part becomes simple:\n\n```\nvar concatenatedBinary = function(n) {\n    let mod = 10 ** 9 + 7;\n    let mul = 2;\n    \n    let ans = 1;\n    for(let i = 2; i <= n; i++){\n        if(i === mul) mul *= 2;\n        ans = (ans * mul + i) % mod;\n    }\n    \n    return ans;\n};\n```
['JavaScript']