Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Max Consecutive Ones
Bookmark
Brute Force
Single Pass
Input
Input 1
Input 2
All Zeros
Custom
nums
=
[1, 1, 0, 1, 1, 1]
1
1
0
1
1
1
0
1
2
3
4
5
count
0
maxCount
0
reads
0
1
1
0
1
1
1
0
1
2
3
4
5
count
0
maxCount
0
reads
0
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
1
maxCount
0
reads
1
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
2
maxCount
0
reads
3
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
1
maxCount
2
reads
5
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
0
maxCount
2
reads
6
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
0
maxCount
2
reads
7
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
2
maxCount
2
reads
9
1
1
0
1
1
1
i
j
0
1
2
3
4
5
count
1
maxCount
3
reads
10
1
1
0
1
1
1
i
0
1
2
3
4
5
count
0
maxCount
3
reads
11
1
1
0
1
1
1
0
1
2
3
4
5
count
1
maxCount
3
reads
12
algo
master
.
io
Step:
Start: try every index as the start of a run of ones
0 / 38
Input
Input 1
Input 2
All Zeros
Custom
nums
=
[1, 1, 0, 1, 1, 1]
0 / 38
algo
master
.
io
Step:
Start: try every index as the start of a run of ones