Solution Smallest Rotation with Highest Score
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    /**\n     * @param Integer[] $nums\n     * @return Integer\n     */\n    function bestRotation($nums) {\n        $n = count($nums);\n        $loss = array_fill(0, $n, 0);\n        \n        for ($i = 0; $i < $n; $i++) {\n            $loss[($i - $nums[$i] + 1 + $n) % $n]--;\n        }\n        \n        $res = 0;\n        \n        for ($i = 1; $i < $n; $i++) {\n            $loss[$i] += $loss[$i - 1] + 1;\n            $res = ($loss[$i] > $loss[$res]) ? $i : $res;\n        }\n        \n        return $res;\n    }\n}\n\n```
['PHP']