#3389
Minimum Operations to Make Character Frequencies Equal
international master · 2070 · lc hard +32 · 26.4% accepted · 75 likes · top 4%
Description
You are given a string s.
A string t is good if every character appears the same number of times.
You may perform any number of operations:
- Delete a character from s.
- Insert a character into s.
- Change a character in s to the next letter in the alphabet (cannot change 'z').
Return the minimum number of operations required to make s good.
Code
1
2
3