In a nutshell
A sliding window is a slice of neighbouring elements that glides across an array. Instead of recomputing each slice from scratch, you update a running total by adding the value that enters on the right and subtracting the one that leaves on the left — so the entire array is covered in a single pass rather than re-scanning every position.