Maximum Increase

Practice this coding question on Coding Gurukul.

Problem statement

A weather station records one reading per hour. Its dashboard highlights the longest uninterrupted stretch during which every new reading is strictly greater than the preceding reading. Missing or rearranging hours would make the highlight misleading, so the readings must remain consecutive. Your task Find the maximum length of a contiguous strictly increasing subarray. Important details Equality ends an increasing stretch. A single reading is a valid stretch of length one. Do not choose a subsequence that skips readings, and report the number of readings rather than the difference between endpoint values. Worked example For readings 2 5 5 6 9 1, the longest stretch is the third through fifth readings, 5 6 9, with length 3. The repeated 5 prevents extending it leftward. For a decreasing sequence, every longest stretch has length 1.

Input format

Read n, then n integer readings.

Output format

Print the maximum stretch length.

Constraints

1 <= n <= 1500; 1 <= reading[i] <= 1000000000.

Sample input

6
2 5 5 6 9 1

Sample output

3

Sign in to run or submit a solution in C++, Java or Python.

Loading Coding Gurukul…