Beats 💯% of all other | Beginner Friendly✅
Intuition\n\n\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n- Create a freq map for every charecter\n- Sort the value of each cha
# Intuition\n![Screenshot 2024-03-17 104545.png](https://assets.leetcode.com/users/images/5c9bde90-8ea0-4755-adfa-65a35d4c2f79_1710652630.1537528.png)\n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n- Create a freq map for every charecter\n- Sort the value of each charecter\n- check for every charecter\n    - if we take the charecter\n    - else we are removing all occurence of the charecter\n- find the min of all\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        freq = Counter(word)\n        mp=sorted(freq.values())\n\n        ans=float("inf")\n        for i in range(len(mp)):\n            mn=mp[i]\n            res=sum(mp[:i])\n            for j in range(i,len(mp)):\n                if mp[j] - mn>k:\n                    res+=(mp[j] - mn)-k\n            ans=min(ans,res)\n        return ans\n```
['Array', 'Hash Table', 'Greedy', 'Sorting', 'Python3']