Longest decreasing run
Find the length of the longest stretch of consecutive elements where each element is strictly smaller than the one before it.
Reported in: Capgemini (2026 batch) (memory-based)
Input
First line: N. Second line: N integers.
Output
The length of the longest decreasing run.
Constraints
1 ≤ N ≤ 10^5.
Example 1
Input:
8
9 7 4 6 5 3 1 2
Output:
4Example 2
Input:
3
1 2 3
Output:
1Hint: Extend the current run while a[i] < a[i−1], otherwise restart it at 1.