Gary has a sequence 'ARR', consisting of 'N' integers.
We'll call a sequence ARR[i],  ARR[i+1], ..., ARR[j] where 1  ≤  i  ≤  j  ≤  N a subsegment of the sequence ARR. The value (j - i + 1) denotes the length of the subsegment.
Your task is to find the longest subsegment of ARR, such that it is possible to change at most one number (change one number to any integer you want) from the subsegment to make the subsegment strictly increasing.
You need to return the length of the maximum subsegment that you can find by changing only one integer in the given sequence.
The first line contains a single integer T representing the number of test cases.
Then T test cases follow.
The first line of test case contains an integer 'N' denoting the length of 'ARR'.
The second line of each test case contains 'N' space-separated integers denoting the elements of 'ARR'.
Output format:
For each test case, print the length of the maximum subsegment that you can find by changing only one integer in the given sequence.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 ≤ N ≤ 10^5
1 ≤  ARR[i]  ≤ 10^9
Time Limit: 1 sec
2
4
1 4 3 4
6
7 2 3 1 5 6
4
5
For test case 1, we'll change the first 4 in the array by 2, thus making the sequence: {1, 2, 3, 4}.
For test case 2, we'll change the value at index 3 in the array by 4, thus making the sequence: {7, 2, 3, 4, 5, 6}.
2
3
7 6 9
1
6
3
1
For test case 1, we'll change the first 7 in the array by 2, thus making the sequence: {2, 6, 9}.
For test case 2, as there is only 1 element present, hence we don't have to change anything.
Can you think of finding the longest increasing subarray?
Here, the idea is to calculate the longest increasing subarray for every element by taking it as the starting as well as the ending point.
Here is the algorithm:
O(N), where N is the size of the array/list ‘ARR’.
Because we are calculating the longest increasing subarray at every point so the time complexity is O(N).
O(N), where N is the size of the array/list ‘ARR’.
Because we have created two extra arrays/lists for storing the longest increasing subarray.