Difficulty Level: Easy

Submissions: 219 Accuracy:


Printing Maximum Sum Increasing Subsequence

The Maximum Sum Increasing Subsequence problem is to find the maximum sum subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order.



The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size array A representing the set of numbers

The second line of each test case contains N space separated integers denoting elements of the array A[ ].


Print all the elements of the maximum sum increasing subsequence for each test case in a new line.


1<= T <=100

1<= N <=1000

1<= A[ ] <=10000




1 101 2 3 100 4 5


1 2 3 100

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

Contributor: Sujnesh Mishra
Author: sujnesh

Set Default Code

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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