Interview question · Sliding window
Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters is a Medium question that uses the sliding window pattern. PrepKit files it under Sliding window.
PrepKit lists the title and a link. The problem statement stays on the original site.
Checking your saved items
Source content: English
Key facts
- Topic
- Sliding window
- Pattern
- sliding window
- Difficulty
- Medium
- Appears in
- Blind 75, NeetCode 150
- Website
- leetcode.com
- License
- MIT License
How to use it
- Read the problem on the original site.
- Try it on your own before you look at hints or solutions.
- Then work through a related question with the same pattern.
About the Sliding window pattern
PrepKit study notes. PrepKit editors wrote these as general advice. They are not taken from the problem or from any published solution.
- What it is
- Keeping a contiguous range over an array or string and moving its edges forward while you update a running state.
- How to recognize it
- The question asks for the longest, shortest or best contiguous subarray or substring that meets a condition.
- Common pitfalls
- Recomputing the whole window at every step, shrinking it at the wrong moment, and using it when negative values break the rule for growing and shrinking.
Related preparation
These are PrepKit study suggestions, not employer endorsements or predictions of interview questions.
- String cheatsheet for coding interviews
A reviewed question-to-resource association.
Pages that include this
Related questions
Common questions
Where can I practice Longest Substring Without Repeating Characters?
Open it on leetcode.com. PrepKit links there and does not copy the problem.
What pattern does Longest Substring Without Repeating Characters use?
PrepKit files it under sliding window, at Medium difficulty.