Max Consecutive Ones II Problem

Max Consecutive Ones II Problem — ExecCode Medium DSA Practice

Solve the Max Consecutive Ones II problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Max Consecutive Ones II. Window with at most one zero. For Max Consecutive Ones II, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input {"nums": [1, 0, 1, 1, 0]}; Output 4

Constraints

1 ≤ n ≤ 10^5

Practice Max Consecutive Ones II free on ExecCode. Browse DSA problems, topic map, and placement guides.