P19620 [HackerEarth] You are given an array of N elements.
普及-
题目描述

You are given an array of N elements.
Array elements have property :
adjacent elements of array differ by atmost '1'.

Now you have to find the maximum length segment in array such that this segment satisfies condition :
absolute difference between the maximum and minimum element of this segment should not be more than 1.

Input :
First line will contain an integer 'T' (number of test cases ).
For each test case there is an integer 'N' (number of elements in array).
On next line there will be N integers (array elements).

Output :
For each test case output the maximum length of required segment.

Constraint :
T ≤ 10
N ≤ 5*100000
1 ≤ a[i] ≤ 1000000

Problem setter : Mohd Abdullah

SAMPLE INPUT
3
3
1 2 3
4
5001 5000 5000 5001
18
10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9

SAMPLE OUTPUT
2
4
3

Explanation

Test case 1:
segment can be : [1,2] , [2,3]
Test case 2 :
segment : [5001,5000,5000,5001]
Test case 3 :
segment : [2,1,2]

输入格式

见题面

输出格式

见题面

样例输入
10 20 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 445413 20 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 586916 20 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 348807 20 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 292945 20 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 403823 20 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 394365 20 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 541416 20 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 416522 20 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 172679 20 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451 297451
样例输出
10383 10777 10793 10386 10649 10362 10690 10763 10540 10172