Problem Description
You are given an numeric string A which only contains 0's and 1's. You have to find a range, such that if we flip all the elements within the range, we will get largest substring of contiguous 1's.
Return the length of largest substring of contiguous 1's after flipping exactly one substring.
NOTE:
1 <= |A| <= 105
First and only argument is an string A.
Return an integer denoting the length of largest substring of contiguous 1's after flipping exactly one substring.
Input 1:
A = "000"
Input 2:
A = "10010"
Output 1:
3
Output 2:
4
Explanation 1:
Flip the substring [0:2] then A = "111" so answer will be 3
Explanation 2:
Flip the substring [1:2] then A = "11110" so answer will be 4
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.