SImple solution
\n\nclass Solution {\n    Integer[][]dp=new Integer[26][26];\n    public int minimumDeletions(String word, int k) {\n        int[]a=new int[26];\n        for(ch
\n```\nclass Solution {\n    Integer[][]dp=new Integer[26][26];\n    public int minimumDeletions(String word, int k) {\n        int[]a=new int[26];\n        for(char ch:word.toCharArray()){\n            a[ch-\'a\']++;\n}\n//if(word.length()==1)return 0;\nint ans=0;\nArrays.sort(a);\nint j=0;\nwhile(a[j]==0)j++;\n //return a[\n    \n  int i=a.length-1;\n\n\n        return f(j,i,a,k);\n    }\n    public int f(int i,int j,int[]a,int k){\n        if(i==j)return 0;\n        if(a[j]-a[i]<=k)return 0;\n        if(dp[i][j]!=null)return dp[i][j];\n        return dp[i][j]=Math.min(a[i]+f(i+1,j,a,k),a[j]-a[i]-k+f(i,j-1,a,k));\n    }\n}\n```
['Java']