Back to Practice Dashboard
Competitive ProgrammingHard
Maximum Sum Increasing Subsequence
Learn how to solve the 'Maximum Sum Increasing Subsequence' problem. This detailed resource details brute force and optimized approaches.
Problem Statement
Hard
Write a function max_sum_is(arr) that returns the maximum sum of any increasing subsequence in an array of integers arr.
Constraints
- •1 <= len(arr) <= 1000
- •-10^4 <= arr[i] <= 10^4
Examples
Example 1
Input
max_sum_is([1, 101, 2, 3, 100, 4, 5])
Output
106
Explanation
The increasing subsequence with the maximum sum is [1, 2, 3, 100] which sums to 106.
Example 2
Input
max_sum_is([3, 4, 5, 10])
Output
22
Explanation
The increasing subsequence is the array itself, summing to 22.
Need a Hint?
Define subproblem states, establish the recurrence relation, and use memoization (top-down) or tabulation (bottom-up).
Edge Cases to Watch
- Empty list or null input variables
- Single item lists/arrays
- Extremely large input bounds causing integer or stack overflow
Ready to Solve?
Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.