Maximum increasing sub array

Given an array of numbers, how to find the maximum length of increasing (non-decreasing) continuous sub-sequence?
For example consider the array [7, 9, 1, 3, 5, 8, 2], the maximum length is 4. Similarly for [23, 10, 18, 18, 6], it is 3.
This is a straight forward implementation problem (appeared on Codeforces). Following is an implementation of O(n) algorithm.

Leave a Reply

Your email address will not be published. Required fields are marked *