Tech_Interview_Prep

Sliding Window

A variable- or fixed-size window over a sequence, expanded and contracted in O(n) total instead of recomputing from scratch.

Q1.In a variable-size sliding window, when do you shrink the window from the left?

Q2.What is the overall time complexity of a sliding window algorithm on an array of size n?

Q3.What phrasing in a problem statement is a strong signal that sliding window applies?

Q4.In a fixed-size sliding window of width k, what happens at each step as the window moves?