#C11784. Minimum Increasing Subarrays
Minimum Increasing Subarrays
Minimum Increasing Subarrays
You are given an array of integers. Your task is to determine the minimum number of strictly increasing subarrays into which the array can be partitioned. In other words, you need to divide the array into contiguous segments such that each segment is strictly increasing and the total number of segments is minimized.
Formally, for an array \(a_1, a_2, \dots, a_N\), you want to choose the minimum integer \(k\) and indices \(1 = i_1 < i_2 < \dots < i_{k+1} = N+1\) such that for every segment \(j\) (where \(1 \le j \le k\)), the subarray \(a_{i_j}, a_{i_j+1}, \dots, a_{i_{j+1}-1}\) is strictly increasing (i.e., \(a_{i_j} < a_{i_j+1} < \cdots < a_{i_{j+1}-1}\)).
If the array is empty (i.e. , \(N=0\)), the answer is considered to be 0.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(T\) representing the number of test cases.
- For each test case, the first line contains an integer \(N\) — the number of elements in the array.
- The next line contains \(N\) space-separated integers representing the array.
outputFormat
For each test case, output a single line containing the minimum number of strictly increasing subarrays needed to partition the array.
## sample1
6
1 2 4 3 5 6
2
</p>