🔥 [CPP] | Freq Array (Max Freq)
\n\n\nclass Solution {\npublic:\n    int minimumDeletions(string word, int k) {\n        int max_freq = 0;\n        vector<int> freq(26);\n        for(auto &w :
\n\n```\nclass Solution {\npublic:\n    int minimumDeletions(string word, int k) {\n        int max_freq = 0;\n        vector<int> freq(26);\n        for(auto &w : word) max_freq = max(max_freq, ++freq[w - \'a\']);\n        \n        int ans = INT_MAX;\n        for(int make = 0; make <= max_freq; make++) {\n            int res = 0;\n            for(auto &cnt : freq) {\n                if(cnt < make) res += cnt;\n                else if(cnt > make + k) res += cnt - make - k;\n            }\n            ans = min(ans, res);\n        }\n        \n        return ans;\n    }\n};\n```
['C++']