Company: EPAM
Difficulty: medium
You are given an array A . You are supposed to answer the maximum length of non decreasing subsegment of an array among all non decreasing subsegments of A . For example, if array A = {1, 2, 6, 5} , the following are subsegments {1}, {1, 2}, {6, 5}. However, the following are not subsegments {1, 6, 2}, {5, 1} etc. Input Format The first line contains a single integer N . The next N line contains integers denoting the array A . Constraints 1 <= N <= 10 5 1 <= A i <= 10 9 Output Format Return a single integer denoting the solution to the problem. Sample Input 1 5 5 2 3 6 4 Sample Output 1 3 Explanation: The longest non-decreasing subsegment is {2, 3, 6}, so the maximum length is 3. Sample Input 2 6 1 2 2 2 3 1 Sample Output 2 5 Explanation: The longest non-decreasing subsegment is {1, 2, 2, 2, 3}, so the maximum length is 5.