Longest 1s After One Flip
You are given a string s containing 1s and 0s. Given that you can flip at most one "0", return the length of the longest contiguous substring of 1s.
Constraints
n ≤ 100,000wherenis the length ofs.
https://binarysearch.com/problems/Longest-1s-After-One-Flip
Examples
Example 1
Input
- s =
10110
Output
- answer =
4
Explanation
If we flip the first zero then we get "11110".
Leave a comment