Delta arrays
\nSince we are rotating to the left, each number changes the total score twice:\n\n(-1) i == x-1\n(+1) i == len(nums)-1\nWe can use this to determine, for each 
\nSince we are rotating to the left, each number changes the total score twice:\n\n(-1) i == x-1\n(+1) i == len(nums)-1\nWe can use this to determine, for each number, at what k\'s the total score would change.\n\nThen we iterate over the changes depending on k to find the maximum possible score.\n\nFinding the formula for number of left-rotations to reduce the value ( ((i+n)-(x-1))%n) took a while with pen and paper.\nI don\'t expect that you find it intuitive.\n\n\n\n# Code\n```\nimpl Solution {\n    pub fn best_rotation(nums: Vec<i32>) -> i32 {\n        let n = nums.len();\n        let mut deltas = vec![0; n];\n        let mut score: i32 = 0;\n        \n        nums.iter().enumerate().for_each(|(i, x)| {\n            let x = *x as usize;\n            deltas[((i+n)-(x-1))%n]-=1;\n\t\t    deltas[(i+1)%n]+=1;\n            if x <= i {\n                score+=1;\n            }\n        });\n        let mut max_score = score;\n        let mut max_idx: i32 = 0;\n        for k in 1..n {\n            score += deltas[k];\n            if score > max_score {\n                max_score = score;\n                max_idx = k as i32;\n            }\n        }\n\t    max_idx\n    }\n}\n```
['Rust']