+ 1

How to find minimum operations required to make frequency of each character in a given string equal

Eg. Input string:- ABCB Output :- 1(A can be changed to C so that frequency of B and C becomes 2)

3rd Feb 2019, 3:10 PM
Aryan 🇮🇳
2 Respuestas
+ 3
What would be the minimum for ABCDEE? 1 because one E can be changed e.g. to an F? Or can we only use letters that already appear in the string?
3rd Feb 2019, 4:23 PM
Anna
Anna - avatar
0
We should use only those characters that already appear in the string. In ABCDEE we can replace A with B and C with D so that each character will have 2 frequency and minimum operations will be 2.
3rd Feb 2019, 4:43 PM
Aryan 🇮🇳