Sliding Window vs Two Pointer

August 5th, 2022

#fundamentals

The "sliding window" algorithm is a derivative of the general two pointer strategy. The difference with "sliding window" is that we are looking at not just the two values at each index but a subset -- or, a "window" -- of the array on each iteration through the array. The window "slides" when the first index of the window changes.