Longest Nice Substring
beginnerFinds the longest substring where every letter appears in both cases using divide-and-conquer.
PhaseInit
K—
Distinct0
Pairs0
Best0
Y
[0]a
[1]z
[2]a
[3]A
[4]a
[5]y
[6]Pair status
Character in window
Nice window / best result
Being evicted (shrink)
Past the left pointer
Input: "YazaAay". Find longest substring where every letter has both cases. Will try k=1..3.
1 / 40