Longest Substring Without Repeating Characters
Read the lesson → understand the pattern → then code. Tutor works offline (built-in teacher); optional Cursor/Gemini keys upgrade chat quality.
Topic refresher: Sliding Window — Live Range
Maintain [L,R] that satisfies a constraint; answer from length/sum/counts.
int L = 0;
for (int R = 0; R < n; R++) {
// add s[R]
while (/* invalid */) { /* remove s[L] */ L++; }
// update answer
}MediumSliding WindowLeetCode #3
Variable window + last-seen index
Expand right; if duplicate inside window, move left past previous occurrence.
Examples
Example 1
Input
abcabcbb
Output
3
Example 2
Input
bbbbb
Output
1
Stuck? Take a nudge
C++17Autosaves