A fixed-size sliding window computes its first total, then shifts right by subtracting the outgoing value and adding the incoming value. It avoids summing the whole range again.
A variable-size window moves its ends according to a condition. Rules such as expanding when a sum is too small need assumptions like nonnegative input to be correct.
When to use
Use it for repeated totals or extrema over contiguous time ranges.