Given a binary array, find the index of 0
to be replaced with 1
to get the maximum length sequence of continuous 1
s. Return that index.
Let array arr
equal to [ 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ]
. The index to be replaced is 7
to get continuous sequence of length 6
containing all 1
s. Therefore the solution should return the integer 7
.