
import java.util.*;
import java.lang.*;
import java.io.*;

class GFG {
	public static void main (String[] args) {
    		
    	Scanner in=new Scanner(System.in);
    	int T=in.nextInt();
    	for(int i=0;i<T;i++){
    		
    		int n=in.nextInt();
    		int arr[]=new int[n];
    		
    		for(int j=0;j<n;j++){
    		    arr[j]=in.nextInt();
    		}
    		int tab[]=arr.clone();
    		int maxval=arr[0];
    		for(int k=1;k<n;k++){
    		    for(int l=0;l<k;l++){
    		        if((arr[k]>arr[l])&&(tab[k]<tab[l]+arr[k])){
    		            tab[k]=tab[l]+arr[k];
    		            if(tab[k]>maxval){
    		                maxval=tab[k];
    		            }
    		            
    		        }
    		    }
    		}
    		System.out.println(maxval);
    		
    	}
	}
}
@@ -1,20 +1,681 @@
+/*%0AGiven an array A of N positive integers. Find the sum of maximum sum increasing subsequence of the given array.%0A%0AInput:%0AThe first line of input contains an integer T denoting the number of test cases. The first line of each test case is N(the size of array). The second line of each test case contains array elements.%0A%0AOutput:%0AFor each test case print the required answer in new line.%0A%0AConstraints:%0A1 %E2%89%A4 T %E2%89%A4 100%0A1 %E2%89%A4 N %E2%89%A4 106%0A1 %E2%89%A4 Ai %E2%89%A4 106%0A%0AExample:%0AInput:%0A2%0A7%0A1 101 2 3 100 4 5%0A4%0A10 5 4 3%0A%0AOutput:%0A106%0A10%0A%0AExplanation:%0ATestcase 1: All the increasing subsequences are : (1,101); (1,2,3,100); (1,2,3,4,5). Out of these (1, 2, 3, 100) has maximum sum,i.e., 106.%0A*/
 %0Aimport java.util.*;
@@ -1417,8 +1417,9 @@
  %09%7D%0A%09%7D%0A%7D
+%0A

Update maximum-sum-increasing-subsequence.java