Back to writing

Sliding window: when interval problems do not need full recomputation

Sliding window is valuable when a continuous interval can be maintained incrementally instead of recomputed from scratch.

Sliding window is valuable when a continuous interval can be maintained incrementally instead of recomputed from scratch.

It is especially useful when:

  • the object is a continuous substring or subarray
  • the goal is the longest or shortest interval under a condition