Move window start over frequencies, 94% speed
image.png\n\n\n# Code\n\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        freq = list(Counter(word).values())\n        ans = 
image.png\n![image.png](https://assets.leetcode.com/users/images/4efa8c96-1117-4b39-a92f-bb05e22cc0ac_1713367198.2275133.png)\n\n# Code\n```\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        freq = list(Counter(word).values())\n        ans = len(word)\n        for start in set(freq):\n            end = start + k\n            ans = min(ans, sum((f - end if f > end else 0) if f >= start else f\n                               for f in freq))\n        return ans\n```
['Python3']