Dynamic Programming21 sections · 916 units
Open in Course

Maximum Sum Increasing Subsequence - Problem Statement

Classic variation

Given an array of integers, find the maximum sum of an increasing subsequence. For [1, 101, 2, 3, 100, 4, 5], the answer is 106 because the subsequence [1, 2, 3, 100] has sum 1+2+3+100=1061+2+3+100=106, which beats [1, 2, 3, 4, 5] with sum 15.

This is LIS where you get the highest sum instead of length. The longest subsequence isn't always the best. For each index, track the maximum sum of an increasing subsequence ending there.