Minimum Substring Partition of Equal Character Frequency
Fill a table of best piece counts for each prefix, trying every balanced piece that ends at that prefix.
Fill a table of best piece counts for each prefix, trying every balanced piece that ends at that prefix.