Interview question · Sliding window
Permutation In String
Permutation In String 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
- 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.
Pages that include this
Related questions
Common questions
Where can I practice Permutation In String?
Open it on leetcode.com. PrepKit links there and does not copy the problem.
What pattern does Permutation In String use?
PrepKit files it under sliding window, at Medium difficulty.