Given an array of integers A, find the length of the longest consecutive elements sequence.
A: [24, 2, 34, 1, 3, 4]
Result: 4
Explanation: The longest consecutive sequence is [1, 2, 3, 4].
A: [24, 2, 34, 1, 3, 4, 3, -1, 28, 0]
Result: 6
Explanation: The longest consecutive sequence is [-1, 0, 1, 2, 3, 4].
The first line contains an integer âTâ denoting the number of test cases.
For each test case, the input has two lines:
For each test case, the output contains one line with an integer denoting the length of the longest increasing sequence.
3
6
24 2 34 1 3 4
10
24 2 34 1 3 4 3 -1 28 0
4
5 7 9 3
4
6
1
1 <= T <= 10
1 <= n <= 105
-109 <= Ai <= 109