Problem 1004 · Medium

Max Consecutive Ones III

Grow a window to the right and shrink it from the left whenever it holds more than k zeros; the widest valid window is the answer.

Open the interactive visualisation