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
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 12. ⌘Enter runs, ⌘⇧Enter submits.