Tap here to switch tabs
Problem
Submissions

Problem: Max Consecutive Ones

Max Consecutive Ones asks you to examine a binary array and return the length of its longest uninterrupted run of ones, with zeros breaking each run.

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

  • 1≤1 \leq nums.length ≤103\leq 10^3

  • nums[i] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Consecutive Ones

Max Consecutive Ones asks you to examine a binary array and return the length of its longest uninterrupted run of ones, with zeros breaking each run.

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

  • 1≤1 \leq nums.length ≤103\leq 10^3

  • nums[i] is either 00 or 11.