Max Consecutive Ones Problem

Max Consecutive Ones Problem — ExecCode Easy DSA Practice

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

Problem description

Max Consecutive Ones: Count streaks of 1. For Max Consecutive Ones, 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, 1, 0, 1, 1, 1]; Output 3

Constraints

1 ≤ n ≤ 10^5 Values fit in 32-bit ints

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