DETAILED EXPLANATION || BEATS 100% USERS
Intuition\n1.) we want to calculate at lowest rotation where given no. start contributing to ouer answer.\n2.) Also we were looking for highest rotation where g
# Intuition\n1.) we want to calculate at lowest rotation where given no. start contributing to ouer answer.\n2.) Also we were looking for highest rotation where given no. ends contributing\n\n# Approach\noriginal = [2,3,1,4,0]\n\n            Rotate by left as question says\n\n            rotate=>0= [2,3,1,4,0] => [0, 0, 1, 0, 1]\n            idx      = [0,1,2,3,4]\n\n            rotate=>1= [3,1,4,0,2] => [0, 1, 0, 1, 1]\n            idx      = [0,1,2,3,4]\n\n            rotate=>2= [1,4,0,2,3] => [0, 0, 1, 1, 1]\n            idx      = [0,1,2,3,4]\n\n            rotate=>3= [4,0,2,3,1] => [0, 1, 1, 1, 1]\n            idx      = [0,1,2,3,4]\n\n            rotate=>4= [0,2,3,1,4] => [1, 0, 0, 1, 1]\n            idx      = [0,1,2,3,4]\n\n            number                            = 2 3 1 4 0\n            starts contibuting after rotation = 1 2 3 4 4\n            ends contibuting  at rotation     = 4 4 2 0 0\n            \n\n            after observation \n\n            starting formula can be achieved as [possible start]  lower_bound = (i + 1) % n;\n            ending   formula can be achieved as [possible end]   upper_bound = (i - nums[i] + n + 1) % n;\n\n            Intuion of lower and Upper-Bound:-\n\n            1.) we want to calculate at lowest rotation where given no. start contributing to ouer answer.\n            2.) Also we were looking for highest rotation where given no. ends contributing\n\n            For lowest rotation -> lower_bound\n            For Highest Rotation -> upper_bound\n\n            Dont confuse with binary Search Lower Bound and Upper bound; \n            It\'s just naming.\n\n# Complexity\n- Time complexity:\nO(n) because we are making a single pass to calculate initial contributions and then updating the score for each possible rotation.\n\n- Space complexity:\nO(n) due to the contributions array that keeps track of score changes across rotations.\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int bestRotation(vector<int>& nums) {\n\n        int n = nums.size();\n        vector<int> contributions(n, 0);\n\n        int total_score = 0;\n\n        for(int i = 0; i < n; i++){\n\n            if(nums[i] <= i){\n                total_score++;\n            }\n\n            int start_idx = (i + 1) % n;\n            int end_idx   = (i - nums[i] + n + 1) % n;\n\n            contributions[start_idx]++; // As it contibutes at start_idx\n\n            if(end_idx < n){\n                contributions[end_idx]--;\n            }\n\n            // The cases where [2,3,1,4,0] start_idx of 1 was 3 and end_idx was 2\n            // Means already contributing\n            // So for prevention only increase count at 0 index only;\n            // Because we are sure that at 0 index it will be definitelty contibuting \n            // if a case occurs where number was present on index 1 so at 0 index it will contibute\n            // We are not sure of at which particular index it is so we will increase only of 0 index\n\n            if(start_idx > end_idx){\n                contributions[0]++; \n            }\n\n        }\n\n        int maxi_score = total_score;\n        int curr_score = total_score;\n\n        int k_rotations = 0;\n\n        for(int i = 0; i < n; i++){\n            curr_score += contributions[i];\n\n            if(curr_score > maxi_score){\n                maxi_score = curr_score;\n                k_rotations = i;\n            }\n        }\n        return k_rotations;\n\n    }\n};\n```
['Array', 'C++']