O(n) Solution | Rust
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimpl Solution {\n    pub fn minimum_deletions(word: String, k: i32) -> i32 {\n        let mut map = [0; 26];\n        let mut ans = i32::MAX;\n\n        for ch in word.chars() {\n            map[ch as usize - 97] += 1;\n        }\n        \n        \n        for &x in map.iter() {\n            let high = x + k;\n            \n            ans = ans.min(\n                map.iter().map(|&y| {\n                    if y > high { y - high }\n                    else if y < x { y }\n                    else { 0 }\n                }).sum()\n            );\n        }\n        \n        ans\n    }\n}\n```
['Rust']