Question
Flip 0s for Max 1s
You are given a binary array of size n and an integer k.

You may flip at most 0's to 1's.

Your task is to determine the maximum possible length of a subarray consisting entirely of ones after performing at most k flips.
Input
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the size of the array and the maximum number of zeroes you can flip.
The second line contains KaTeX can only parse string typed expression integers — KaTeX can only parse string typed expression — representing the elements of the array.
Output
Output a single integer — the maximum length of a subarray containing only ones after flipping at most KaTeX can only parse string typed expression zeroes.
Example
Input
10 2  
1 0 1 1 0 0 1 1 1 0

Output
7

Explanation
Flipping the zeroes at indices 4 and 5 results in the longest subarray of ones with length KaTeX can only parse string typed expression.

Online