Longest Non-Decreasing Run
Find the length of the longest contiguous run of non-decreasing values (each element ≥ the previous one).
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: one integer — the length of the longest such run.
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
7 2 2 5 3 4 4 1
Output 1
3
Input 2
1 9
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.