Maximum sum of elements not part of LIS
Medium Accuracy: 35.59% Submissions: 805 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:

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


Example 2:

Input:
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)


Constraints:
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.

Editorial

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

Yes

All Submissions

My Submissions:

Login to access your submissions.

Maximum sum of elements not part of LIS

Output Window