Sliding Window
The Sliding Window Technique
is a method used to efficiently solve problems
that involve processing subarrays
or substrings
within a larger sequence.
It operates by maintaining a window with either a static or a dynamic size, depending on the requirements of the problem.
The advantage of keeping such window is that we can drop
the time complexity from to .
In fact, a typical brute-force approach would require a double pass (hence ),
whereas a Sliding Window
one can reduce it to a single one (hence ).