Talentd/FleetCode/Problems/

3231. Minimum Number of Increasing Subsequence to Be Removed

Hard
Read SolutionWatch Video

3231. Minimum Number of Increasing Subsequence to Be Removed

Hard47.3% AcceptancePremium
PremiumFree on FleetCode

Given an array of integers nums, you are allowed to perform the following operation any number of times:

  • Remove a strictly increasing subsequence from the array.

Your task is to find the minimum number of operations required to make the array empty.

Example 1:

Input: nums = [5,3,1,4,2]

Output: 3

Explanation:

We remove subsequences [1, 2], [3, 4], [5].

Example 2:

Input: nums = [1,2,3,4,5]

Output: 1

Example 3:

Input: nums = [5,4,3,2,1]

Output: 5

Constraints:

  • 1 <= nums.length <= 105
  • 1 <= nums[i] <= 105

Loading editor...

[5,3,1,4,2]