Sliding Window Problems
Template
For most substring problem, we are given a string and need to find a substring of it which satisfy some restrictions. A general way is to use a hashmap assisted with two pointers.
Algorithm
Use two pointers: start and end to represent a window.
Move end to find a valid window.
When a valid window is found, move start to find a smaller window.
Last updated