Python Medium
\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        c = Counter(word)\n        arr = list(c.values())\n        arr.sort()\n   
```\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        c = Counter(word)\n        arr = list(c.values())\n        arr.sort()\n        N = len(arr)\n        \'\'\'\n        [1, 2]\n        \n        can also make chars 0\n        \'\'\'\n        # median = arr[N//2]\n        # if N % 2 == 0:\n        #     median = math.ceil((arr[N // 2] + arr[(N - 1) // 2]) / 2)\n        # print(arr, k)\n        \'\'\'\n        NEW PROBLEM: \n        \n        given an array of nums and an integer k, what is the minimum number of decrements to make all numbers k apart (or a number can be 0)\n        \n        say we have a goal range[a, a + k] where we want all numbers inside, where a is an integer\n        \n        costs:\n        if num < a: cost = num -> (we want to make num 0)\n        \n        if a <= num <= a + k: cost = 0\n        \n        if num > a + k: cost = num - (a + k)\n        \n        \n        can we use binary search?\n        \n        \n        \'\'\'\n        best = 10 ** 20\n        \n        for a in arr:\n            interval = [a, a + k]\n            total = 0\n            \n            for v in arr:\n                if v < interval[0]:\n                    total += v\n                elif interval[0] <= v <= interval[1]:\n                    pass\n                else:\n                    total += v - interval[1]\n            \n            best = min(best, total)\n            \n \n        \n        \n        return best\n        \n```
['Python3']