Sliding

Home  >> Sliding

Sliding

  • A technique used to optimize problems that involve arrays, lists, or strings.

  • It maintains a subset (window) of elements and slides it across the collection to find a result (e.g., max sum, substring, etc.).

  • Commonly used in problems involving:

    • Subarrays

    • Streams of data

    • Time-based metrics (e.g., moving averages)