Find Maximum Sum Strictly Increasing Subarray
Submissions: 1005   Accuracy:

41.52%

  Difficulty: Easy   Marks: 2

Given an array of positive integers. Find the maximum sum of strictly increasing subarrays.

Example:

Input: arr[] = {1, 2, 3, 2, 5, 1, 7}

Output: 8

Explanation:

Some Strictly increasing subarrays are -

{1, 2, 3} sum = 6,

{2, 5} sum = 7,

{1, 7} sum = 8,

maximum sum = 8

Input:

The first line of input contains T denoting the no. of test cases . Then T test cases follow . The first line of each test case contains an Integer N and the next line contains N space separated values of the array A[ ] .


Output:

For each test case output the required result in a new line.


Constraints:

1<=T<=100
1<=N<=100
1<=A[ ] <=1000


Example:

Input:

2

7

1 2 3 2 5 1 7

4

1 2 2 4

Output:

8

6

** For More Input/Output Examples Use 'Expected Output' option **

Author: shubhbaranwal


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.