#K60982. Longest Positive Streak
Longest Positive Streak
Longest Positive Streak
You are given a sequence of daily balance adjustments represented by an array of integers \(a_1, a_2, \ldots, a_n\). Your task is to find the length of the longest streak (i.e. contiguous subarray) in which every day’s balance is strictly greater than the previous day. Formally, you need to find the maximum length of a subarray \(a_l, a_{l+1}, \ldots, a_r\) such that \(a_i > a_{i-1}\) for every \(l < i \le r\).
Note that if the array contains fewer than 2 elements, the answer is defined to be 0 (since there is no valid pair of consecutive days).
Examples:
- For the array: [-1, 2, 2, 0, 5, 6, 3, 4, 4], the longest streak is 3.
- For an increasing array: [1, 2, 3, 4, 5], the longest streak is 5.
- For a decreasing array: [5, 4, 3, 2, 1], the longest streak is 1.
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains an integer \(n\) representing the number of elements in the array.
- The second line contains \(n\) space-separated integers denoting the daily balance adjustments.
outputFormat
Output a single integer to standard output (stdout) representing the length of the longest streak of days such that for each consecutive pair \(a_{i-1}\) and \(a_i\), \(a_i > a_{i-1}\).
## sample9
-1 2 2 0 5 6 3 4 4
3