Search⌘ K
AI Features

Solution: Max Consecutive Ones

Explore how to implement a straightforward algorithm to find the maximum number of consecutive ones in a binary array. Learn to track the current and maximum streaks while iterating through the array once, understand the time and space complexity, and apply this pattern to similar coding challenges.

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 ...