#K60742. Longest Non-Decreasing Subarray
Longest Non-Decreasing Subarray
Longest Non-Decreasing Subarray
Given an array of integers representing temperature readings, determine the length of the longest contiguous subarray in which the readings do not decrease. In other words, find the maximum length of a subarray where every subsequent temperature is greater than or equal to the previous temperature. The condition can be formulated as: \(a_i \leq a_{i+1}\) for every consecutive pair \(a_i\) and \(a_{i+1}\) within the subarray.
If the array is empty, return 0.
inputFormat
The first line contains an integer \(N\), the number of temperature readings. The second line contains \(N\) space-separated integers where each integer represents a temperature reading.
outputFormat
Print a single integer, the length of the longest non-decreasing contiguous subarray.
## sample7
1 2 2 3 1 2 2
4