Given an array of n positive integers. this is a program to find the sum of maximum sum subsequence of the given array such that the integers in the subsequence are in increasing order. I am trying to implement the code based on this YouTube video I do not know what I am doing wrong.
class MaxIncreasingSumSubSequence(object):
def incsum(self,nums):
maxvalue = 0
sumlist = nums
for i in range(1,len(nums)):
for j in range(i):
if nums[j] < nums[i] and nums[i] + sumlist[j] > sumlist[i]:
sumlist[i] = nums[i] + sumlist[j]
maxvalue = max(sumlist)
print(maxvalue)
MaxIncreasingSumSubSequence().incsum([1, 101, 2, 3, 100, 4, 5])