Given a binary array nums and an integer k, return the maximum number of consecutive 1s in the array if you can flip at most k 0s.
nums = [1,1,1,0,0,0,1,1,1,1,0], k = 26nums = [0,0,1,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,1], k = 310The window [L,R] always contains at most k zeros (which we can flip to 1s). When a new zero pushes us over budget, we slide L right until we're within budget again. The window size R−L+1 at each R gives the max window ending at R with at most k flips. We track the maximum over all R.