2.3 Random Numbers
(RankList for this Question)
Score: 30pts
Time Limit: 5.00 sec
You are given random numbers in a line. There are a total of n numbers.

What is the longest sequence of successive numbers where each number is different?

Constraints
1 <= t <= 10
1 ≤ n ≤ 1000
1 ≤ k[i] ≤ 10^5

Input Format
The first input line contains a number of test cases t.

The second input line contains an integer
n: the number of lines

The next line has n integers k1,k2,…,kn: the numbers.

Output Format
Print the length of the longest sequence of unique numbers.

Example 1
Input:
1
8
1 2 1 3 2 7 4 2

Output:
5

Explanation:
‎Longest correct sequence is 1, 3, 2, 7, 4 i.e. length is 5

Log In to solve the Question