Minimum Subsequence in Non-Increasing Order
A easy-tier problem at 73% community acceptance, tagged with Array, Greedy, Sorting. Reported in interviews at Mercari and 0 others.
You're asked to return the lexicographically smallest subsequence whose sum is at least the total sum of the input array. This is a greedy problem disguised as a subsequence question, and it's easier than it sounds. Mercari has asked it. The trap is overthinking it. You don't need dynamic programming or backtracking. You need to understand that greedy selection by value works here, and that's it. 70% acceptance rate means the candidates who get it usually move fast.
Companies that ask "Minimum Subsequence in Non-Increasing Order"
Minimum Subsequence in Non-Increasing Order is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderThe insight is simple: sort the array in decreasing order and greedily pick the largest elements until you hit the target sum. Since you're picking greedily by size and returning in non-increasing order, you automatically get the lexicographically smallest subsequence. Most candidates either waste time on DP or misunderstand what 'lexicographically smallest' means in context. The pattern is Array, Greedy, and Sorting combined. If you hit this in a live OA and blank on why greedy works here, StealthCoder surfaces the solution in seconds. The real speed is in recognizing that a subsequence requirement doesn't mean you need exponential search; it just means you can pick non-contiguous elements.
Pattern tags
You know the problem.
Make sure you actually pass it.
Minimum Subsequence in Non-Increasing Order recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Subsequence in Non-Increasing Order interview FAQ
Why does greedy work for this problem?+
Because you want the lexicographically smallest result with a target sum. Picking the largest available numbers first minimizes the count and ensures smaller numbers stay out of the result, which minimizes the lexicographic order. Greed on value directly optimizes the outcome.
Is this still asked at top companies?+
Mercari has reported it. It's an easy-tier problem, so it appears less frequently in FAANG loops than medium or hard problems. If you see it, it's usually a warm-up or a screening round filter to move quickly.
What's the most common mistake candidates make?+
Trying to use DP or recursion to explore all subsequences. The problem looks like a subset-sum variant, but it's actually just sorting and iteration. Candidates also confuse 'non-increasing order' (the output format) with the selection strategy (which is still greedy by value).
Do I need to handle duplicates or negative numbers?+
Input constraints aren't specified here, but duplicates don't break the greedy strategy. Negatives would change the logic. Check the problem statement directly. Sorting handles duplicates fine; greedy picks them when needed.
How does this relate to Greedy and Sorting as topics?+
Sorting sets up the greedy choice. You sort descending once, then iterate once to accumulate the sum. Both topics are essential; neither works alone. It's a textbook example of Greedy + Sorting, not a pure Greedy problem.
Want the actual problem statement? View "Minimum Subsequence in Non-Increasing Order" on LeetCode →