CodeMentor
.
Ask AI
Problems
Learn
C++
TCS
Core CS
HR
Progress
Search
Ctrl
K
0
Lv 1
Problems
Arrays
Max Consecutive Ones
Easy
LeetCode
14/14
00:00
Hint
Run
Ctrl
↵
Submit
Description
Lesson
Code walk
Solution
Easy
Arrays
LeetCode #485
Max Consecutive Ones
Count streaks of 1s; keep a max.
Examples
Example 1
Input
6 1 1 0 1 1 1
Output
3
Example 2
Input
4 1 0 1 1
Output
2
Stuck? Take a nudge
Reveal hint 1 of 3
C++17
Autosaves
Reset
Console
Run your code to see results