Max Consecutive Ones

Easy · rating 950 · Arrays

The first line has n. The second line has n integers, each 0 or 1. Print the length of the longest run of consecutive 1s.

Constraints: 1 ≤ n ≤ 105

Related problems

Open Max Consecutive Ones in Code Arena →