Approach hintTry it first, then revealHide
Precompute the number of distinct letters in every prefix and in every suffix with a running seen-array; each split point can then be evaluated in O(1).
Precompute the number of distinct letters in every prefix and in every suffix with a running seen-array; each split point can then be evaluated in O(1).