#K82162. Longest Increasing Consecutive Subsequence

    ID: 35915 Type: Default 1000ms 256MiB

Longest Increasing Consecutive Subsequence

Longest Increasing Consecutive Subsequence

You are given a sequence of integers. Your task is to determine the length of the longest consecutive subsequence where each number is strictly greater than the previous one. The subsequence must be contiguous (i.e., the elements are adjacent in the original sequence).

For example, given the sequence \(1, 2, 2, 3, 5, 4\), the longest increasing consecutive subsequence is \(1, 2, 3\) with a length of 3 because even though \(5\) is greater than \(3\), it is not part of any longer contiguous subsequence of increasing numbers.

Note: If the sequence is empty, the answer is 0.

inputFormat

The input starts with an integer \(T\) representing the number of test cases. Each test case is given in one line containing an integer \(N\) (the number of elements) followed by \(N\) space-separated integers representing the sequence.

Example:

4
6 1 2 2 3 5 4
5 10 20 30 40 50
5 5 4 3 2 1
0

outputFormat

For each test case, output a single line with an integer that represents the length of the longest consecutive subsequence of strictly increasing integers.

Example Output:

3
5
1
0
## sample
4
6 1 2 2 3 5 4
5 10 20 30 40 50
5 5 4 3 2 1
0
3

5 1 0

</p>