✔ Python3 Solution | Prefix Sum
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\nPython\nclass Solution:\n    def bestRotation(self, A):\n        n = len(A)\n        P 
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```Python\nclass Solution:\n    def bestRotation(self, A):\n        n = len(A)\n        P = [1] * n\n        for i in range(n):\n            P[(i - A[i] + 1) % n] -= 1\n        P = list(accumulate(P))\n        return P.index(max(P))\n```
['Prefix Sum', 'Python3']