Skip to content
Onsite

Longest Run of Zeros

EasyP3Coding

s is a binary string. Return the length of its longest substring made only of 0 characters, or 0 if s has no 0.

Example 1

Input
s = "1001000"
Output
3

Example 2

Input
s = "0000"
Output
4

Example 3

Input
s = "1111"
Output
0

Constraints

  • 1 <= s.length <= 10^5
  • s contains only '0' and '1'.

Hints

Run checks the 3 visible tests, Submit all 12.