Use the equivalent of a sliding window (without precomputation