Copied to Clipboard
Maximum sum of elements not part of LIS
Medium Accuracy: 37.14% Submissions: 950 Points: 4

Given an array Arr[], the task is to find the maximum sum of all the elements which are not a part of the longest increasing subsequence.

Example 1:

n = 6
Arr = {4, 6, 1, 2, 4, 6}
Output: 10
Explaination: Elements are 4 and 6.

Example 2:

n = 5
Arr = {5, 4, 3, 2, 1}
Output: 14
Explaination: Elements are 5,4,3 and 2.

Your Task:
You don't need to read input or print anything. Your task is to complete the function maxSumLis() which takes the array Arr[] and its size as input parameters and returns maximum sum of elements not part of LIS.

Expected Time Complexity: O(n2)
Expected Auxiliary Space: O(n)

1 ≤ N ≤ 1000

1 ≤ Arr[i] ≤ 105

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Maximum sum of elements not part of LIS

Output Window