Longest Consecutive 1s Problem

Longest Consecutive 1s Problem — ExecCode Easy DSA Practice

Solve the Longest Consecutive 1s problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a binary array nums, return the maximum number of consecutive 1 's in the array.

Examples

Input {"n": 15}; Output 4. Input {"n": 5}; Output 1. Input {"n": 7}; Output 3

Constraints

1 <= nums.length <= 10^5 nums[i] is either 0 or 1.

Practice Longest Consecutive 1s free on ExecCode. Browse DSA problems, topic map, and placement guides.