Company: Airtel_24sep
Difficulty: medium
Operate the Subarray Problem Description You're given an array A of N positive numbers. In a single operation you may pick any subarray and collapse it down to one entry holding its sum, and you may repeat this operation as many times as you like. Determine the greatest possible length of a non-decreasing array reachable this way. For example: starting from A = [1, 2, 6, 9], collapsing the subarray [2,6] into its sum yields A = [1, 8, 9]. So a single operation is enough to make this array non-decreasing. Input format: The input consists of two lines: The first line will contain an integer N. The second line contains N space-separated integers denoting the array elements. The input will be read from the STDIN by the candidate. Output format: Print a number that denotes the maximum length of the non-decreasing array after performing the above operations. The output will be matched to the candidate's output printed on the STDOUT. Examples Example 1: Input: 7 5 1 6 3 4 2 8 Output: 4 Explan