Tap here to switch tabs
Problem
Ask
Submissions

Problem: Max Consecutive Ones

easy
15 min
Explore how to identify and track the longest sequence of consecutive ones in a binary array. This lesson helps you understand the problem constraints and develop an efficient solution, strengthening your skills for coding interview patterns involving data tracking and problem-solving.

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 nums.length 103\leq 10^3

  • nums[i] is either 00 or 11.

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Max Consecutive Ones

easy
15 min
Explore how to identify and track the longest sequence of consecutive ones in a binary array. This lesson helps you understand the problem constraints and develop an efficient solution, strengthening your skills for coding interview patterns involving data tracking and problem-solving.

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 nums.length 103\leq 10^3

  • nums[i] is either 00 or 11.