3. Longest Substring Without Repeating Characters(Sliding window approach)

Опубликовано: 17 Май 2026
на канале: EverydayLeetcode
109
6

Here is a problem that can be solved using the sliding window approach:
Summary:
1. Move your end pointer through the string
2. If you find a repeating character keep removing from the start until you find the repeating character. Then remove the character at the start pointer and then add the character at the end pointer.
3. If you do not find a repeating character simply add the new character into the set and update the maxsize.