The TransCompilator

Solved LeetCode program · 360 of 1,000

#0485 · Max Consecutive Ones

Easy Array chunk-08.md

Original English source

The numbers is a list of 1, 1, 0, 1, 1, 1. The best is 0. The run is 0.
For each value in numbers.
If value is 1, add 1 to run, otherwise set run to 0. If run is more than best, set best to run.

Show best.

Open in Playground Browse all 1,000 problems

Expected stdout

3