#K50132. Longest Strictly Increasing Contiguous Subsequence
Longest Strictly Increasing Contiguous Subsequence
Longest Strictly Increasing Contiguous Subsequence
Given T test cases, each test case provides a sequence of integers. For each test case, you are to find the length of the longest contiguous subsequence such that each element is strictly greater than its preceding element.
Details:
- If the length of the sequence is
n = 0
, then the answer is0
. - For each sequence, you must compute the maximum length of a segment where the elements are in strictly increasing order.
Example:
Input: 2 5 3 2 5 1 7 6 1 2 3 4 5 6</p>Output: 2 6
In the first test case, the maximum contiguous strictly increasing segment is either [2,5]
or [1,7]
with a length of 2
. In the second test case, the entire sequence is strictly increasing, so the answer is 6
.
inputFormat
The input is read from standard input and has the following format:
- The first line contains an integer T, representing the number of test cases.
- For each test case:
- The first line contains an integer
n
, the number of elements in the sequence. - The second line contains
n
space-separated integers representing the sequence.
If n
is zero, the test case will not include any sequence numbers and the output should be 0
for that test case.
outputFormat
For each test case, output a single line containing one integer: the length of the longest contiguous strictly increasing subsequence in the sequence.
## sample2
5
3 2 5 1 7
6
1 2 3 4 5 6
2
6
</p>