O(N), Python with explanation, easy to understand
\nRestate the defination -- the i-th entry is worth 1 point when:\n v<=f(i, k),  where v=nums[i] denotes value, f(i, k) denotes new index of i after k rotation.
\nRestate the defination -- the i-th entry is worth 1 point when:\n* **v<=f(i, k)**,  where v=nums[i] denotes value, f(i, k) denotes new index of i after k rotation.\n\nWe know that **f(i, k) = (i-k)%N**, which is equivalent to\n* i+N-k, when i<k; \n* i-k, when i>=k\n\nThen for i-th entry, k must be in either of the 2 intervals\n1. i+N-k>=v and i < k --> k in [0, i-v]\n2. i-k>=v and i>=k --> k in [i+1, i+N-v]\n\nSince  0 <= v < N, i+1<=i+N-v. So the 2nd interval won\'t be empty.\nBut when i>=v, the 1st interval is empty, and i+N-v >= N.\nSo we use intervals [0, max(0, i-v+1)) and [i+1, min(N,i+N-v+1)) to avoid these problems.\n\n```\nclass Solution:\n    def bestRotation(self, nums: List[int]) -> int:\n        N = len(nums)\n        score = [0]*(N+1) # add 1 digit to avoid index out of range\n        for i, v in enumerate(nums): # [0, i-v] [i+1, N-1]\n            score[0] += 1\n            score[max(0, i-v+1)] -= 1 # in case i-v+1 < 0\n            score[i+1] += 1\n            score[min(N, N+i-v+1)] -= 1 # in case N+i-v+1 > N\n        ret = 0\n        for i in range(1, N): # stop at N-1\n            score[i] += score[i-1]\n            if score[i] > score[ret]:\n                ret = i\n        return ret\n```
[]