Sliding Window is a repeated product-company interview pattern because it tests whether you can turn a brute-force idea into a predictable invariant.
Open on LeetCodeGiven daily prices, find the maximum profit from one buy followed by one sell.
prices = [7, 1, 5, 3, 6, 4] -> 5
prices = [7, 6, 4, 3, 1] -> 0
Try framing your own approach first. The 30 seconds you think before peeking is where learning happens.
Reveal the approach first.
Your rating tunes when this problem shows up again.