Part 3 of 14

Pointers, Window, Prefix

Two-pointer techniques, fixed and variable sliding windows, prefix sums, and prefix-sum-plus-hash. The highest interview-ROI part of the curriculum.

Chapters
6
Hours
2
Difficulty
Intermediate
  1. 3.0intermediate

    Two pointers: opposite ends

    Two pointers, opposite ends: the inward sweep, sorted-array invariants, and the canonical 'sum to target' / 'pair under constraint' patterns.

    20 min
  2. 3.1beginner

    Two pointers: same direction

    Two pointers, same direction: fast-slow pointers, in-place filtering, and the array problems that disguise this pattern.

    15 min
  3. 3.2intermediate

    Sliding window: fixed size

    Fixed-size sliding windows: maintaining a running aggregate in O(1) per step, and the problems whose constraint is window length.

    15 min
  4. 3.3intermediate

    Sliding window: variable size

    Variable-size sliding windows: shrinking when the invariant breaks, and the longest-substring / minimum-window problem family.

    20 min
  5. 3.4beginner

    Prefix sums and difference arrays

    Prefix sums: O(1) range-sum queries, 2D extensions, and the subarray-sum problems that simplify once the right precomputation is in place.

    20 min
  6. 3.5intermediate

    The prefix-sum + hash-map combo

    Prefix sum + hash map: counting subarrays with a target sum, the canonical 'subarray sum equals K' problem family, and modulo extensions.

    20 min