⚡Greedy || 🌟Sorting || 🔥HashMap
\n\n# Complexity\n\n- Time complexity:\nO(26 * 26)\n\n- Space complexity:\nO(26)\n\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n\nclass Solution {\npubl
\n\n# Complexity\n```\n- Time complexity:\nO(26 * 26)\n\n- Space complexity:\nO(26)\n```\n\n# Code\n## Please Upvote if it helps\uD83E\uDD17\n```\nclass Solution {\npublic:\n    int minimumDeletions(string word, int k) {\n        int n = word.size(), mini = INT_MAX;\n        unordered_map<char, int> mp;\n        for(auto it : word)\n            mp[it]++;\n        vector<int> vec;\n        for(auto it : mp)\n            vec.push_back(it.second);\n        sort(vec.begin(), vec.end());\n        int m = vec.size(), prefix = 0;\n        for(int i = 0 ; i < m ; i++){\n            int j = m - 1, tmp = 0;\n            while(vec[j] - vec[i] > k)\n                tmp += (vec[j--] - vec[i] - k);\n            mini = min(mini, prefix + tmp);\n            if(!tmp)\n                break;\n            prefix += vec[i];\n        }\n        return mini;\n    }\n};\n```
['Greedy', 'Ordered Map', 'Sorting', 'C++']