prefix
and suffix
of length equal to the string length.uniqueChars
to keep track of unique characters.uniqueChars
.
b. Update prefix[i]
with the size of uniqueChars
.uniqueChars
for the next iteration.uniqueChars
.
b. Update suffix[i]
with the size of uniqueChars
.goodSplits
to count the number of good splits.prefix[i]
is equal to suffix[i + 1]
, increment goodSplits
.goodSplits
.