You are given a binary array nums (it has only 0s and 1s) and an integer k. You can flip at most k zeros into ones.
Return the length of the longest block of 1s next to each other that you can get.
Examples
Example 1:
Input: nums = [1,0,0,1,1,0,1], k = 2
Output: 5
Explanation: Flip the 0s at positions 1 and 2. The first five numbers all become 1s.
Example 2:
Input: nums = [0,0,0], k = 1
Output: 1
Explanation: You can flip only one zero, so the longest block has 1 number.
Example 3:
Input: nums = [1,1,0,1,0,0,1,1,1], k = 1
Output: 4
Explanation: Flip the 0 at position 2. Positions 0 to 3 become 1s. (Flipping position 5 also gives 4.)