Minimum Substring Partition of Equal Character Frequency
Given a string s, partition it into one or more balanced substrings.
Return the minimum number of substrings that you can partition s into.
Note: A balanced string is a string where each character in the string occurs the same number of times.
Example 1
Input
s = "fabccddg"Output
3We can partition
s into 3 balanced substrings, such as ("fab", "ccdd", "g") or ("fabc", "cd", "dg").Example 2
Input
s = "abababaccddb"Output
2We can partition
s into 2 balanced substrings as ("abab", "abaccddb").Constraints
- 1 <= s.length <= 1000
- s consists only of English lowercase letters.