Tap here to switch tabs
Problem
Submissions

Problem: Max Consecutive Ones II

med
30 min
Try to solve the Max Consecutive Ones II problem.

Statement

Given a binary array nums, return the maximum number of consecutive 11’s in the array if you are allowed to flip at most one 00.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • nums[i] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Consecutive Ones II

med
30 min
Try to solve the Max Consecutive Ones II problem.

Statement

Given a binary array nums, return the maximum number of consecutive 11’s in the array if you are allowed to flip at most one 00.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • nums[i] is either 00 or 11.