Back to Browse

DP - 5: Maximum Sum Increasing Subsequence

5.4K views
Feb 11, 2020
25:12

Source Code:https://thecodingsimplified.com/maximum-sum-of-increase-subsequences/ Solution: - We initialize an array (mis), where initial value for each number is set to it's value, because in case of descreasing array sequence, there'll be answer only of 1 length - Now we'll traverse in a loop from 2nd element of array & will keep chekcing with every element that if this is greater than previous one & if it's mis(j) + a[i] greater than mis(i), then update the MIS of current value - On the same time, we also store a variable as max, which will hold the maximum value Time Complexity: O(n^2) Space Complexity: O(n) Do Watch video for more info CHECK OUT CODING SIMPLIFIED https://www.youtube.com/codingsimplified ★☆★ VIEW THE BLOG POST: ★☆★ http://thecodingsimplified.com I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I've published over 400+ videos. ★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★ https://www.youtube.com/codingsimplified?sub_confirmation=1 ★☆★ Send us mail at: ★☆★ Email: [email protected]

Download

0 formats

No download links available.

DP - 5: Maximum Sum Increasing Subsequence | NatokHD