Core Idea
A valid window contains at most k zeros, because those zeros can be flipped to ones.
Algorithm
Scan with two pointers and count zeros in the current window. When the count exceeds k, move the left pointer until the window is valid again.
Common Mistakes
The best answer is the maximum valid window length seen during the scan. Cases with k = 0 and all-zero arrays should work without special casing.