Hi Codeforces,
Please help me to solve this problem.
You are given an array of size N.
A special subarray of Arr is choosen keeping the following conditions in mind
Let the length of first array choosen must be len-1 the length of last subarray choosen must be 1
Let sum of ith subarray is X and (i+1)th is Y then X must be less than Y
The choosen array must not overlap
Find the maximum length of special subarray(if max length is N, then the subarrays of length N,N-1....,1 must exists and sum of those subarrays must increasing) that could be choosen from Arr
Note It is given that you are only allowed to choose subarray in order of their occurrence in Arr This Means that index of all elements in first choosen subarray will always be less than the index of all elements choosen in second subarray and so on
Constraints 1 <= N <= 100000 1 <= Arr[i] <= 1000000000
Test cases: 1. A = [2,1,3,5,8,6,15] Here, the answer is 3([2,1,3],[5,8],[15]) We can split the array of length 3,2,1 and the sum also increasing. 2. A = [1,2,3,4] For the above array the answer is 2 because [1,2],[4] we cannot split the array for more than length 2.