Java Clean Solution || Weekly Contest
Complexity\n- Time complexity:O(n+Soting + 26*26)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(26)\n Add your space complexity here, e.g.
# Complexity\n- Time complexity:$$O(n+Soting + 26*26)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(26)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minimumDeletions(String word, int k) {\n        int[] freq = new int[26];\n        for(char ch:word.toCharArray()){\n            freq[ch-\'a\']++;\n        }\n        \n//         Sorted in Increasing order\n        Arrays.sort(freq);\n        int min_del = Integer.MAX_VALUE;\n        \n        for(int i=freq.length-1; i>=0; i--){\n            int trgt = freq[i];\n            int dels = 0;\n            \n            for(int f:freq){\n                if(f > trgt + k){\n                    dels += f - (trgt+k); \n                } else if(f < trgt){\n                    dels += f;\n                }\n            }\n            \n            min_del = Math.min(min_del, dels);\n            if(min_del == 0){\n                break;\n            }\n        }\n        \n        return min_del==Integer.MAX_VALUE?0:min_del;\n    }\n}\n```
['Array', 'Python', 'Java', 'Python3']