#K77242. Longest Increasing Subarray

    ID: 34821 Type: Default 1000ms 256MiB

Longest Increasing Subarray

Longest Increasing Subarray

You are given an array of sales figures. Your task is to find the length of the longest contiguous subarray in which the elements are strictly increasing. Formally, given an array \(a_1, a_2, \ldots, a_n\), you need to find the maximum length \(L\) such that there exists an index \(i\) with \(1 \le i \le n-L+1\) and \(a_i < a_{i+1} < \cdots < a_{i+L-1}\). If the array is empty, the answer is 0.

inputFormat

The input is given via standard input (stdin) and has the following format:

  • The first line contains a single integer \(n\) representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers representing the sales figures.

outputFormat

Output a single integer to standard output (stdout), which is the length of the longest contiguous subarray with strictly increasing values.

## sample
9
1 2 3 1 2 4 6 1 2
4