Maximum Consecutive Ones - 2

easy
1. You are given an array(arr) which contains only 0's and 1's and a number K.
2. You have to find the maximum number of consecutive 1's in the given array if you can flip at most K zeroes.

Input Format

A number N arr1 arr2... N numbers A number K

Output Format

A number representing maximum number of consecutive 1's after flipping at most K zeroes.

Constraints

1 <= N <= 10^5
0 <= arr[i] <= 1
1 <= K <= N

Example

Input
6
1 1 0 0 1 1
1
Output
3
Previous
Maximum Consecutive Ones - 1
Next
Longest Substring With At Most K Unique Characters

Related Questions