JS || Solution by Bharadwaj
Code\n\nvar bestRotation = function (nums) {\n    let acc = new Uint32Array(100001);\n    let n = nums.length;\n    acc.fill(0, 0, n + 1);\n    for (let i = 0; 
# Code\n```\nvar bestRotation = function (nums) {\n    let acc = new Uint32Array(100001);\n    let n = nums.length;\n    acc.fill(0, 0, n + 1);\n    for (let i = 0; i < n; ++i) {\n        ++acc[Math.min(i + 1, Math.max(0, i - nums[i] + 1))];\n    }\n    let bestInd = 0;\n    let bestCnt = n - acc[0];\n    let currCnt = bestCnt;\n    for (let i = 1; i < n; ++i) {\n        currCnt -= acc[i];\n        if (nums[i - 1] < n) {\n            ++currCnt;\n            let exp = i + n - nums[i - 1];\n            if (exp < n) ++acc[exp];\n        }\n        if (currCnt > bestCnt) {\n            bestCnt = currCnt;\n            bestInd = i;\n        }\n    }\n    return bestInd;\n};\n```
['JavaScript']