Sliding Window
7 min · Python examples
Track a moving subarray window to answer range questions without restarting from scratch.
Techniques · Sliding Window0/5 cleared
Enemy 1 of 5
A fixed-size window of length k slides across an array. Add the new element entering the window and subtract the one leaving — no need to resum the whole slice each time.
You
Invisible Heisenbug
Loading editor…
Target output: 9
Stuck? Ask Rena
Your AI tutor that gives assistance.
Asking Rena in lessons is on Ultimate.