Company: EPAM
Difficulty: medium
Maximum Increasing Subarray You are given an array A of N integers. A subsegment (also called a subarray) is a nonempty contiguous block of elements from the array. Call a subsegment non-decreasing when each element, other than the last, is no greater than the element right after it. Find the greatest length among every non-decreasing subsegment of A . As an illustration, with A = [1, 2, 6, 5] , [1] , [1, 2] , and [6, 5] are each subsegments since their elements sit next to each other. That said, [6, 5] fails to be non-decreasing. Sequences like [1, 6, 2] and [5, 1] are not subsegments at all, since they skip over a contiguous stretch of the original array. Input Format The first line contains a single integer N , the number of elements in the array. Each of the next N lines contains one integer Aᵢ . Output Format Print a single integer: the maximum length of a non-decreasing subsegment of A . Constraints 1 ≤ N ≤ 10⁵ 1 ≤ Aᵢ ≤ 10⁹ The answer is between 1 and N , inclusive. Execution tim