#K8941. Longest Increasing Contiguous Subarray

    ID: 37524 Type: Default 1000ms 256MiB

Longest Increasing Contiguous Subarray

Longest Increasing Contiguous Subarray

Given an array of integers, your task is to find the length of the longest contiguous subarray in which the elements are strictly increasing.

A subarray is defined as a contiguous sequence of elements from the array. Formally, for an array A of length n, a subarray A[i...j] (where 1 ≤ i ≤ j ≤ n) is increasing if:

[ A_i < A_{i+1} < \cdots < A_j ]

If the array is empty, the result should be 0. For example, given the array [1, 2, 2, 3, 4, 1], the longest increasing contiguous subarray is [2, 3, 4] with a length of 3.

You need to process multiple test cases. For each test case, first you are given an integer n representing the size of the array, followed by n integers. Output the result for each test case on a new line.

inputFormat

The first line of input contains an integer T indicating the number of test cases.

For each test case, the first line contains an integer n representing the number of elements in the array. The next line contains n integers separated by spaces.

Example:

3
6
1 2 2 3 4 1
5
5 4 3 2 1
5
1 2 3 4 5

outputFormat

For each test case, output a single integer representing the length of the longest increasing contiguous subarray. Each result should be printed on a separate line.

Example Output:

3
1
5
## sample
3
6
1 2 2 3 4 1
5
5 4 3 2 1
5
1 2 3 4 5
3

1 5

</p>