Skip to content
We areTOP 1%

Longest Substring Without Repeating Characters

MediumLeetCodeSliding Window
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Keep a window with no repeated characters; when the incoming character already occurs inside it, move the left end just past that occurrence, tracked in a last-seen array.

More in Sliding Window

Sliding Window questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Maximum Average Subarray ILeetCodeEasy Solve Maximum Average Subarray I on LeetCode (opens in a new tab)
2Lecture SleepCodeforcesEasy 1200Solve Lecture Sleep on Codeforces (opens in a new tab)
3Ternary StringCodeforcesEasy 1200Solve Ternary String on Codeforces (opens in a new tab)
4Binary DequeCodeforcesEasy 1200Solve Binary Deque on Codeforces (opens in a new tab)
5Longest Substring Without Repeating CharactersLeetCodeMedium Solve Longest Substring Without Repeating Characters on LeetCode (opens in a new tab)
6Permutation in StringLeetCodeMedium Solve Permutation in String on LeetCode (opens in a new tab)
7Max Consecutive Ones IIILeetCodeMedium Solve Max Consecutive Ones III on LeetCode (opens in a new tab)
8Fruit Into BasketsLeetCodeMedium Solve Fruit Into Baskets on LeetCode (opens in a new tab)
9Longest Repeating Character ReplacementLeetCodeMedium Solve Longest Repeating Character Replacement on LeetCode (opens in a new tab)
10Money TreesCodeforcesMedium 1300Solve Money Trees on Codeforces (opens in a new tab)
11BooksCodeforcesMedium 1400Solve Books on Codeforces (opens in a new tab)
12Vasya and StringCodeforcesMedium 1500Solve Vasya and String on Codeforces (opens in a new tab)
13Minimum Window SubstringLeetCodeHard Solve Minimum Window Substring on LeetCode (opens in a new tab)
14Sliding Window MaximumLeetCodeHard Solve Sliding Window Maximum on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account