check all ranges from 0 to k to (maxfreq - k) to (maxfreq)
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```\n#define ll long long\n\nll find(int low, int high, vector<int> &fr)\n{\n    ll res = 0;\n    \n    for(int i=0; i<fr.size(); ++i)\n    {\n        int curr = fr[i];\n        \n        if(curr < low)\n            res+=curr;\n        else if(curr > high)\n            res+=curr-high;        \n    }\n\n    return res;\n}\n\nclass Solution {\npublic:\n    int minimumDeletions(string word, int k) {\n        \n        unordered_map<char, int> m;\n        \n        for(int i=0; i<word.length(); ++i)\n            m[word[i]]+=1;\n        \n        vector<int> fr;\n        \n        for(auto i=m.begin(); i!=m.end(); ++i)\n            fr.push_back(i->second);\n\n        \n        sort(fr.begin(), fr.end());\n        int mx = fr.back();\n\n        int low = 0;\n        int high = k;\n        \n        ll res = 1e9;\n        bool stat = true;\n        \n        while(high <= mx)\n        {\n            ll now = find(low, high, fr);\n            res = min(now, res);\n            \n            ++low;++high;\n            stat = false;\n        }\n        \n        if(stat)\n            return 0;\n\n        return res;   \n    }\n};\n\n\n```
['C++']