Maximum Sum Increasing Subsequence
easy
1. You are given a number n, representing the number of elements. 2. You are given n numbers, representing the contents of array of length n. 3. You are required to print the sum of elements of the increasing subsequence with maximum sum for the array.
Constraints
0 <= n <= 20 0 <= n1, n2, .. <= 100
Format
Input
A number n .. n more elements
Output
A number representing the sum of elements of the increasing subsequence with maximum sum for the array.
Example
Sample Input
10
10
22
9
33
21
50
41
60
80
1
Sample Output
255
Question Video