Max Consecutive Ones

In this question we are asked:

Given a binary array, find the maximum number of consecutive 1s in this array.

Input: [1,1,0,1,1,1]
Output: 3

Click "Answer" tab to see the answer. Try to do it yourself first!

Last updated