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
- 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.
- 3.1beginner
Two pointers: same direction
Two pointers, same direction: fast-slow pointers, in-place filtering, and the array problems that disguise this pattern.
- 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.
- 3.3intermediate
Sliding window: variable size
Variable-size sliding windows: shrinking when the invariant breaks, and the longest-substring / minimum-window problem family.
- 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.
- 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.