Search⌘ K
AI Features

Solution: Max Consecutive Ones

Understand how to solve the max consecutive ones problem by tracking the current and maximum streaks of 1s with a simple, efficient approach in C#. This lesson helps you implement a clean one-pass algorithm with optimal time and space complexity.

Statement

You are given a binary array nums (an array that contains only 00s and 11s). Your task is to find the maximum number of consecutive 11s in the array and return it.

Constraints

  • 11 \leq ...