Basic

18.55%

Given an array of 0 and 1, in how many iterations the whole array be filled with 1's if in a single iteration immediate neighbours of 1's can be filled.

**NOTE: **If you cannot fill array with 1's then print "-1" .

**Input:**

The first line contains a single integer T i.e. the number of test cases. The first line consists of a single integer N(length of array) . The next line consists of a N spaced integers(either 0 or 1).

**Output:**

In one line print the minimum number of iterations to fill the whole string with 1's.

**Constraints:**

1<=T<=100

1<=N<=1000

0<=A[i]<=1

**Examples:**

**Input:**

2

15

1 0 1 0 0 1 0 1 1 0 1 1 0 0 1

17

0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1

**Output:**

1

2

**Explanation:**

**Test Case 1:**

To convert the whole array into 1's, one iteration is required . Between index i=2 and i=5 , the zero at i=3 would be converted to '1' due to its neighbour at i=2 similarly the zero at i=4 would be converted into '1' due to its neighbour at i=5 , all this can be done in a single iteration.