⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 21s17 days 22 hours 20 minutes 21 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 21s17 days 22 hours 20 minutes 21 seconds.

Sign in to watch this lesson
Algorithms - Arrays · 4:08
The stretch between two same-direction pointers is a window, and many array problems are about moving it cleverly. A variable window finds the longest stretch of [2, 1, 5, 1, 3, 2] with sum at most 8 by growing on the right and shrinking on the left, and a fixed window slides a running sum over prices (and a rolling VWAP) in constant time per step, measured against recomputing. We pin down when windows work, break them with negative numbers, and turn 'at most k' into 'exactly k'.