`{"id":"c24e07d8-257f-448f-afa0-c984adcde4d1","name":"Maximum Sum Increasing Subsequence","description":"1. You are given a number n, representing the number of elements.\r\n2. You are given n numbers, representing the contents of array of length n.\r\n3. You are required to print the sum of elements of the increasing subsequence with maximum sum for the array.","inputFormat":"A number n\r\n.. n more elements","outputFormat":"A number representing the sum of elements of the increasing subsequence with maximum sum for the array.","constraints":"0 &lt;= n &lt;= 20\r\n0 &lt;= n1, n2, .. &lt;= 100","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"10\r\n10\r\n22\r\n9\r\n33\r\n21\r\n50\r\n41\r\n60\r\n80\r\n1","sampleOutput":"255","questionVideo":"https://www.youtube.com/embed/5ToHur2XrA4?end=231","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"54acc5fb-90df-43cb-95d2-f96b87af5345","name":"Maximum Sum Increasing Subsequence","slug":"maximum-sum-increasing-subsequence","type":1}],"next":{"id":"44f25b8f-9b99-4e1d-a35e-e92082b43088","name":"Maximum Non-overlapping Bridges","type":1,"slug":"maximum-non-overlapping-bridges"},"prev":{"id":"dccad2d6-0b63-4737-acd1-4cc9160a6cef","name":"Count Brackets","type":1,"slug":"count-brackets"}}}`

# Maximum Sum Increasing Subsequence

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.

`{"id":"c24e07d8-257f-448f-afa0-c984adcde4d1","name":"Maximum Sum Increasing Subsequence","description":"1. You are given a number n, representing the number of elements.\r\n2. You are given n numbers, representing the contents of array of length n.\r\n3. You are required to print the sum of elements of the increasing subsequence with maximum sum for the array.","inputFormat":"A number n\r\n.. n more elements","outputFormat":"A number representing the sum of elements of the increasing subsequence with maximum sum for the array.","constraints":"0 &lt;= n &lt;= 20\r\n0 &lt;= n1, n2, .. &lt;= 100","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"10\r\n10\r\n22\r\n9\r\n33\r\n21\r\n50\r\n41\r\n60\r\n80\r\n1","sampleOutput":"255","questionVideo":"https://www.youtube.com/embed/5ToHur2XrA4?end=231","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"54acc5fb-90df-43cb-95d2-f96b87af5345","name":"Maximum Sum Increasing Subsequence","slug":"maximum-sum-increasing-subsequence","type":1}],"next":{"id":"44f25b8f-9b99-4e1d-a35e-e92082b43088","name":"Maximum Non-overlapping Bridges","type":1,"slug":"maximum-non-overlapping-bridges"},"prev":{"id":"dccad2d6-0b63-4737-acd1-4cc9160a6cef","name":"Count Brackets","type":1,"slug":"count-brackets"}}}`

Editor

# 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

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}10 10 22 9 33 21 50 41 60 80 1```

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}255`

Question Video

Discussions

Show Discussion

Related Resources