Java solution only 10 lines of code very easy
\nclass Solution {\n    public int bestRotation(int[] nums) {\n        int n = nums.length;\n        int[] loss = new int[n];\n        for(int i = 0; i < n; i++
```\nclass Solution {\n    public int bestRotation(int[] nums) {\n        int n = nums.length;\n        int[] loss = new int[n];\n        for(int i = 0; i < n; i++){\n            loss[(i - nums[i] + 1 + n) % n]--;\n        }\n        int res = 0;\n        for(int i = 1; i < n; i++){\n            loss[i] += loss[i - 1] + 1;\n            res = loss[i] > loss[res] ? i : res;\n        }\n        return res;\n    }\n}\n```
['Java']