C++||With explanation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\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 {\npublic:\n    int solve(int minV,vector<int>&arr,int k)//Range=[minV,minV+k]\n    {\n        int ans=0;\n        for(int i=0;i<arr.size();i++)\n        {\n            if(arr[i]<minV)\n            {\n                ans+=arr[i];\n                continue;\n            }\n            if(arr[i]>minV+k)\n            {\n                ans+=arr[i]-(minV+k);\n            }\n        }\n        return ans;\n        \n    }\n    int minimumDeletions(string word, int k) {\n        //Main point here is we have onlly 26 unique elements\n        //Whenever question says that diff between any two element is less than or eqal to k it means all values must be in some range\n        // if k==0 means all value should be equal\n        // if k=1 means only two values are allowed which is consecutive \n        // k=2 means three values are allowed which is consecutive\n        // so if we fix smallest value then we will know the range will be from [smallest_value,smallest_value+k];\n        vector<int>freq(26,0);\n        for(auto it:word)freq[it-\'a\']++;\n         \n        vector<int>arr;\n        for(int i=0;i<26;i++)\n        {\n            if(freq[i])arr.push_back(freq[i]);\n        }\n        sort(arr.begin(),arr.end());\n        int ans=1e9;\n        for(int i=0;i<=arr.back();i++)//selecting minV\n        {\n           ans=min(ans,solve(i,arr,k)); \n        }\n        return ans;\n        \n    }\n};\n```
['C++']