Skip to content

Practice Minimum Subsequence in Non-Increasing Order

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1403
LeetCode Problem

Minimum Subsequence in Non-Increasing Order

Problem Statement

Given the array nums, obtain a subsequence of the array whose sum of elements is strictly greater than the sum of the non included elements in such subsequence. If there are multiple solutions, return the subsequence with minimum size and if there still exist multiple solutions, return the subsequence with the maximum total sum of all its elements. A subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. Note that the solution with the given constraints is guaranteed to be unique. Also return the answer sorted in non-increasing order.

Source: Minimum Subsequence in Non-Increasing Order on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [4,3,10,9,8]
Output
[10,9]

# Example 2

Input
nums = [4,4,7,6,7]
Output
[7,7,6]

Constraints

1 <= nums.length <= 500
1 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Minimum Subsequence in Non-Increasing Order.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.