← ALL NOTES
Hash Table

3090. Maximum Length Substring With Two Occurrences

The constraint that actually bites is per-letter: a valid window holds at most two copies of any single character, and the instant a third copy of some letter c slides in from the right, the only repair is to push left forward until that same c is back down to two.

Loading…