#K66502. Longest Increasing Subarray
Longest Increasing Subarray
Longest Increasing Subarray
You are given an array of integers representing the heights of hills. Your task is to find the length of the longest contiguous subarray where each element is strictly greater than the previous one.
More formally, given an array \(a_1, a_2, \ldots, a_n\), you need to determine the maximum integer \(L\) such that there exists an index \(i\) (\(1 \le i \le n-L+1\)) with the property:
[ a_{i} < a_{i+1} < \cdots < a_{i+L-1} ]
If the array is empty, then the answer is 0.
Example:
Input: 8 5 1 2 3 1 2 3 4 Output: 4
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(n\) representing the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the heights.
If \(n = 0\), then there is no second line and the output should be \(0\).
outputFormat
Output a single integer representing the length of the longest contiguous subarray with strictly increasing heights. The output should be written to standard output (stdout).
## sample1
5
1