Problem 16 of 75
Max Consecutive Ones III
The problem
Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's.
([1,1,1,0,0,0,1,1,1,1,0], 2) → 6
Your solution runs against 2 unit tests, including edge and large-value cases.
Loading...
Test console · 2 unit tests
Submit your code to run it against all 2 unit tests. Results appear here.
JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.