#K95317. Almost Increasing Sequence

    ID: 38837 Type: Default 1000ms 256MiB

Almost Increasing Sequence

Almost Increasing Sequence

You are given an array of integers. The task is to determine whether the array can be made strictly increasing by removing at most one element.

An array a[0], a[1], ..., a[n-1] is strictly increasing if for all valid indices i we have $$a_i < a_{i+1}$$.

If the array is already strictly increasing, no removals are needed. If it can be made strictly increasing by removing one element, consider that as a valid case as well. In both cases, output 0. Otherwise, output -1.

Note: For each test case, you need to check the possibility after removing at most one element. The input consists of multiple test cases.

inputFormat

The first line of the input contains a single integer T denoting the number of test cases.

For each test case, the first line contains an integer n representing the number of elements in the array.

The second line contains n space-separated integers representing the array elements.

outputFormat

For each test case, output a single line containing 0 if the array can be made strictly increasing by removing at most one element; otherwise, output -1.

## sample
1
5
1 2 4 3 5
0

</p>