A partition ends when we've included the last occurrence of every character seen so far.
Precompute last index of each character.
Scan with a window [start..end] where end is max last index among chars in window.
When i==end, cut partition.
A partition ends when we've included the last occurrence of every character seen so far.
Precompute last index of each character.
Scan with a window [start..end] where end is max last index among chars in window.
When i==end, cut partition.