human
Maximum Sum Increasing Subsequence | DP | maxSumIS ( ) returns the maximum sum of increasing subsequence in arr [ ] of size n.
Initialize msis values for all indexes.
Compute maximum sum values in bottom up manner.
Pick maximum of all msis values.
Driver Code"
Solution in Python:
assistant
#Here is code to maximum Sum Increasing Subsequence and the other steps required.
 def maxSumIS ( arr , n ) :
	max = 0
	msis = [ 0 for x in range ( n ) ]
	for i in range ( n ) :
		msis [ i ] = arr [ i ]
	for i in range ( 1 , n ) :
		for j in range ( i ) :
			if ( arr [ i ] > arr [ j ] and msis [ i ] < msis [ j ] + arr [ i ] ) :
				msis [ i ] = msis [ j ] + arr [ i ]
	for i in range ( n ) :
		if max < msis [ i ] :
			max = msis [ i ]
	return max
arr = [ 1 , 101 , 2 , 3 , 100 , 4 , 5 ]
n = len ( arr )
print ( " Sum ▁ of ▁ maximum ▁ sum ▁ increasing ▁ " + " subsequence ▁ is ▁ " + str ( maxSumIS ( arr , n ) ) )