Max Consecutive Ones III
Asked in the Screening stage.
Given a binary array nums and an integer k, implement longest_ones(nums, k) to return the maximum length of a contiguous subarray containing at most k zeroes. Treat those zeroes as flipped to ones.
nums is an array of integers containing only 0 and 1. k is a non-negative integer. Return an integer representing the maximum achievable length.
def longest_ones(nums, k):