Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.

book
Counting the Longest Zero Streak

Given a binary array consisting of only 0s and 1s, return the length of the longest segment of consecutive 0s (also referred to as a blank space) in the array.

Example 1

Input:

[1, 0, 0, 1, 0]

Output:

2

Example 2

Input:

[1, 1, 1]

Output:

0
main.cpp

main.cpp

C++

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

some-alt