Not Optimal Solution O(n^2) Solution Passed OJ
\nclass Solution {\n    public int bestRotation(int[] A) {\n        \n        Map<Integer, Integer> points = new HashMap<>();\n        int N = A.length;\n      
```\nclass Solution {\n    public int bestRotation(int[] A) {\n        \n        Map<Integer, Integer> points = new HashMap<>();\n        int N = A.length;\n        int best = -1;\n        for(int K = 0; K < N; K++){\n            points.put(K, getPoints(A, K));\n            best = Math.max(best, points.get(K));\n        }\n        \n        for (int K = 0; K < N; K++){\n            if (points.get(K) == best) return K;\n        }\n        \n        return -1; //So java compiler will shut up\n    }\n    \n    int getPoints(int[] A, int K){\n        int N = A.length;\n        int points = 0;\n        \n        \n        for (int i = 0; i < N; i++){\n            int mappedIndex = (i-K + N) % N;\n            if (A[i] <= mappedIndex) points++;\n        }\n        \n        return points;\n    }\n}\n```
[]