#C549. Longest Strictly Decreasing Subarray
Longest Strictly Decreasing Subarray
Longest Strictly Decreasing Subarray
You are given an integer (n) representing the number of trees and an array of (n) integers representing the heights of the trees. Your task is to determine the length of the longest contiguous subarray (i.e., a segment of consecutive elements) that is strictly decreasing. In other words, you need to find the maximum integer (k) such that there exists an index (i) with (a_i > a_{i+1} > \cdots > a_{i+k-1}).
For example, if the input array is [1, 3, 2, 1, 5, 4], the longest strictly decreasing subarray is [3, 2, 1] with a length of 3.
inputFormat
The first line of input contains a single integer (n) (1 ≤ (n) ≤ 10^5) representing the number of trees. The second line contains (n) space-separated integers where each integer represents the height of a tree.
outputFormat
Output a single integer which is the length of the longest strictly decreasing contiguous subarray.## sample
1
1
1