⚡ AlgoZen_
~/home/sliding_window/sliding_window_(max_sum)

Sliding Window (Max Sum)

Beginner

Maintain a window of fixed or variable size that slides across an array. Add the new element on the right and remove the old element on the left — no need to recompute the full sum.

time:O(n)
space:O(1)
⚡ +100_XP
step[1/7]
> Start
L
2
1
R
5
1
3
2
Find maximum sum subarray of size k=3. Sliding window avoids recomputing the whole sum each time.

// tap NEXT STEP to walk through one step at a time