Optimal Algorithmic Approach
Sliding window + HashMap storing last index of each char for O(1) jump.
Core Invariants & Edge Cases
- Sliding window with a HashSet or character-to-index map
- When a repeat is found, shrink the window from the left
- Track max window size throughout