5 ms Beats 97.91%
Code\njava []\nclass Solution {\n    public int minimumDeletions(String word, int k) {\n        int freq[]=new int[26];\n        for(int i=0;i<word.length();i++
# Code\n```java []\nclass Solution {\n    public int minimumDeletions(String word, int k) {\n        int freq[]=new int[26];\n        for(int i=0;i<word.length();i++){\n            freq[word.charAt(i)-\'a\']++;\n        }\n        Arrays.sort(freq);\n        int res=Integer.MAX_VALUE;\n        for(int i=0;i<26;i++){\n            int sum=0;\n            if(freq[i]!=0){\n                \n                for(int j=i;j<26;j++){\n                    if(freq[j]!=0){\n                        sum+=Math.min(freq[i]+k,freq[j]);\n                    }\n                    res=Math.min(res,word.length()-sum);\n                }\n            }\n        }\n        return res;\n\n        \n       \n    }\n}\n```
['Java']