Showing:
Handle Score
@Ibrahim Nash 6424
@mb1973 5704
@Quandray 5245
@akhayrutdinov 5111
@saiujwal13083 5046
@sanjay05 3762
@kirtidee18 3673
@mantu_singh 3532
@marius_valentin_dragoi 3523
@sushant_a 3459
Size of array after repeated deletion of LIS
Medium Accuracy: 37.95% Submissions: 141 Points: 4

Given an array nums[0..n-1] of positive element. The task is to find remaining elements of nums[] after repeated deletion of LIS (of size greater than 1). If there are multiple LIS with same length, we need to choose the LIS that ends first.

Example 1:

Input: nums = {1,2,5,3,6,4,1}
Output: {1}
Explanation: From {1,2,5,3,6,4,1}
{1,2,5,6} can be deleted. Now from
remaining {3,4,1} {3,4} can be deleted.


Example 2:

Input: nums = {1,2,3,1,5,2}
Output: {-1}
Explanation: From {1,2,3,1,5,2}
{1,2,3,5} can be deleted. Now from
{1,2} the whole list can be deleted.


You don't need to read or print anything. your task is to complete the function minimize() which takes nums as input parameter and returns a list of elments which is remaining after repeated deletion. If all elements can be deleted then returns a list containing -1.

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

Constraints:
1 <= n <= 500
1 <= nums[i] <= 1000