#C8117. Longest Increasing Subarray
Longest Increasing Subarray
Longest Increasing Subarray
Given an array Arr of N integers, your task is to compute for each element the length of the longest contiguous subarray that is strictly increasing and contains that element. A subarray is said to be strictly increasing if for every consecutive indices \(i-1\) and \(i\), the inequality \(a_{i-1} < a_i\) holds. In other words, for each index, you need to determine the length of the increasing run ending at that index.
For example, if Arr = [1, 2, 2, 3, 4, 4, 5], then the answer is [1, 2, 1, 2, 3, 1, 2].
inputFormat
The first line contains an integer N, representing the number of elements in the array. The second line contains N space-separated integers which constitute the array Arr.
outputFormat
Print a single line of N space-separated integers, where the i-th integer indicates the length of the longest contiguous strictly increasing subarray that contains the i-th element of Arr.## sample
7
1 2 2 3 4 4 5
1 2 1 2 3 1 2
</p>