1647. Minimum Deletions to Make Character Frequencies Unique
Problem Statement
Input: s = "aab"
Output: 0
Explanation: s is already good.Input: s = "aaabbbcc"
Output: 2
Explanation: You can delete two 'b's resulting in the good string "aaabcc".
Another way it to delete one 'b' and one 'c' resulting in the good string "aaabbc".Input: s = "ceabaacb"
Output: 2
Explanation: You can delete both 'c's resulting in the good string "eabaab".
Note that we only care about characters that are still in the string at the end (i.e. frequency of 0 is ignored).Intuition
Links
Video Links
Approach 1:
Approach 2:
Approach 3:
Approach 4:
Similar Problems
Previous1282. Group the People Given the Group Size They Belong ToNext823. Binary Trees With Factors
Last updated