nums contains only 0s and 1s. You may flip at most k zeros to ones. Return the length of the longest run of ones you can get.
For nums = [1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0] and k = 2 the answer is 6.
Example 1
Input:
longest_ones([1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0], 2)
Output:
6
Example 2
Input:
longest_ones([0, 0, 1, 1, 1], 0)
Output:
3
0 <= len(nums) <= 2000000 <= k <= len(nums)No results yet
Run your code to check it against the examples, or submit to run every test.