#K51242. Longest Continuous Positive Growth
Longest Continuous Positive Growth
Longest Continuous Positive Growth
You are given measurements of growth for several test cases. For each test case, the first number n corresponds to the number of days, followed by n integers representing the growth measurements for those days.
Your task is to find the length of the longest contiguous segment where the measurements are strictly positive (i.e. > 0). Formally, if we denote the measurements by \(a_1, a_2, \dots, a_n\), you need to determine the maximum integer \(k\) such that there exists an index \(i\) with \(a_i > 0, a_{i+1} > 0, \dots, a_{i+k-1} > 0\). If there is no positive measurement in a test case, the answer should be 0.
Input/Output: The input is read from standard input and the output is written to standard output.
inputFormat
The first line of input contains an integer \(t\) representing the number of test cases. For each test case, the first line contains an integer \(n\) (the number of days). The second line contains \(n\) space-separated integers indicating the growth measurements for each day.
Example:
3 7 1 2 3 -1 2 3 4 5 0 -1 2 3 5 4 -2 -1 -3 -4
outputFormat
For each test case, output a single integer on a separate line representing the length of the longest contiguous period of positive growth.
Example Output:
3 3 0## sample
1
7
1 2 -1 4 5 -2 1
2
</p>