Module 7 · Sliding Window · Sliding Window Intro

Max consecutive ones III

Flipping at most k zeros means finding the longest window with at most k zeros. Grow it on the right while it's good; the zero that makes k + 1 ends a good window one shorter; then shrink from the left until a zero leaves.