Given a binary array, find the index of 0 such that when that 0 is replaced with 1 results in longest continuous sequence of 1's. For example, for array {0,1,1,1,0,1,0} replacing 0 at 0th index with 1 results in a sequence of 1's with length 4 and replacing 0 at index 4 with 1 results in a sequence of 1's with length 5. Hence for this input array, output returned should be 4.

For array {0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,1,1,1,1,0} longest sequence of 1's is obtained when we replace 0 at index 12 with 1.