#C2642. Longest Strictly Increasing Subarray
Longest Strictly Increasing Subarray
Longest Strictly Increasing Subarray
You are given a sequence of n candies, each with a certain sweetness value. Your task is to find the length of the longest subarray (continuous segment) where each candy's sweetness is strictly greater than the previous one.
Input Format:
- The first line contains an integer n, representing the number of candies.
- The second line contains n integers separated by spaces, representing the sweetness values of the candies.
Output Format:
- Output a single integer, the length of the longest strictly increasing subarray.
Note: A subarray is a contiguous part of the array.
Mathematical formulation:
Find the maximum k such that there exists an index i for which \[ a_i < a_{i+1} < \cdots < a_{i+k-1} \] holds.
inputFormat
The input consists of two lines:
- The first line contains an integer
n
(\(1 \leq n \leq 10^5\)). - The second line contains
n
integers, representing the sweetness values of the candies.
outputFormat
Output a single integer which is the length of the longest strictly increasing subarray.
## sample6
1 2 2 3 5 6
4