Given an integer array nums and an integer k, partition nums into the minimum number of subsequences such that each element in nums belongs to exactly one subsequence.
Return the minimum number of subsequences required such that the difference between the maximum value and the minimum value in every subsequence is at most k.
Note: A subsequence is a sequence that can be derived from an array by deleting zero or more elements without changing the relative order of the remaining elements.
Constraints:
nums.length
nums[i]
k
Given an integer array nums and an integer k, partition nums into the minimum number of subsequences such that each element in nums belongs to exactly one subsequence.
Return the minimum number of subsequences required such that the difference between the maximum value and the minimum value in every subsequence is at most k.
Note: A subsequence is a sequence that can be derived from an array by deleting zero or more elements without changing the relative order of the remaining elements.
Constraints:
nums.length
nums[i]
k