Minimum Deletions to Make String K-Special
Intuition\nvery simple\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O
# Intuition\nvery simple\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int solve(int []ch,int i,int j,int k,int dp[][]){\n        if(i==j || ch[j]-ch[i]<=k) return 0;\n        if(dp[i][j]!=-1) return dp[i][j];\n        return dp[i][j]=Math.min(ch[i]+solve(ch,i+1,j,k,dp), ch[j]-ch[i]-k+solve(ch,i,j-1,k,dp));\n    }\n    public int minimumDeletions(String w, int k) {\n        \n        int ch[] = new int[26];\n        for (char c : w.toCharArray()) {\n            ch[c - \'a\']++;\n        }\n        \n        Arrays.sort(ch);\n        int dp[][]=new int[26][26];\n        for(int row[]: dp) Arrays.fill(row,-1);\n        return solve(ch,0,25,k,dp);\n    }\n}\n```
['Dynamic Programming', 'Memoization', 'Java']