#K64927. Maximum Consecutive Increasing Trees
Maximum Consecutive Increasing Trees
Maximum Consecutive Increasing Trees
You are given a sequence representing the heights of trees. Your task is to determine the maximum number of consecutive trees that form a strictly increasing sequence.
Formally, given a sequence \(h_1, h_2, \dots, h_n\), find the maximum length \(L\) such that for some index \(i\) (\(1 \leq i \leq n - L + 1\)), \[ h_i < h_{i+1} < \cdots < h_{i+L-1} \] holds. Note that even a single tree is counted (i.e., \(L \geq 1\)) and an empty sequence should yield 0.
Input constraints: \(0 \leq n \leq 10^5\).
inputFormat
The input is given via standard input (stdin). The first line is an integer \(n\) representing the number of trees. If \(n > 0\), the second line contains \(n\) space-separated integers representing the heights of the trees. If \(n = 0\), the second line is omitted.
outputFormat
Print a single integer representing the maximum number of consecutive trees with strictly increasing heights.
## sample7
2 1 4 7 3 8 9
3
</p>