0PricingLogin
Competitive Programming Academy · Lesson

Longest Substring Without Repeats

Track last-seen positions in a window.

A Classic Window Problem

Find the longest substring with no repeated character. It is a sliding-window favorite that shows up across nearly every judge. 🔤

The Brute-Force Trap

Checking every substring for duplicates costs about O(n^2) or worse. For long strings that is far too slow, so a smarter sweep is needed.

All lessons in this course

  1. Fixed-Size Window Sums
  2. Variable Window with Two Pointers
  3. Longest Substring Without Repeats
  4. Count Windows That Satisfy a Rule
← Back to Competitive Programming Academy