#3085
Minimum Deletions to Make String K-Special
specialist · 605 · lc medium +29 · 67.2% accepted · 679 likes · top 73%
Description
Given a string word and a non-negative integer k, call word k-special if for every pair of characters, the absolute difference of their frequencies is at most k. Return the minimum number of character deletions needed to make word k-special.
Code
1
2
3