Maximum Subsequence Score
A medium-tier problem at 54% community acceptance, tagged with Array, Greedy, Sorting. Reported in interviews at DE Shaw and 0 others.
Maximum Subsequence Score is a medium-difficulty problem that looks deceptively simple until you hit the wall on your first attempt. DE Shaw has asked this one, and the acceptance rate hovers around 54%, which means half the people who submit walk away with a wrong answer. The trap is trying to brute-force all subsequences or greedy-pick the largest values without understanding the constraint that ties them together. If this lands in your live OA and you blank on the right approach, StealthCoder surfaces the solution in seconds, invisible to the proctor.
Companies that ask "Maximum Subsequence Score"
Maximum Subsequence Score 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 core trick: you need to maximize the product of a subsequence's sum and its minimum value. Brute force explodes exponentially. The insight is that once you fix the minimum element, you can greedily pick the largest remaining elements to maximize the sum. Sort the array, iterate through each element as a potential minimum, then use a heap to track the k largest elements seen so far. This transforms an intractable problem into a linear scan with heap operations. Most candidates either miss the sorting insight entirely or waste time on recursion. The greedy heap approach is the pattern that clicks once you see it, but without it you're spinning.
Pattern tags
You know the problem.
Make sure you actually pass it.
Maximum Subsequence Score recycles across companies for a reason. It's medium-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.
Maximum Subsequence Score interview FAQ
Why can't I just try all subsequences?+
Because the search space is exponential. With n elements, there are 2^n subsequences. Even for n=40, that's over a trillion states. You need the sorting and heap trick to reduce it to O(n log n), which is the only viable path.
Is this still asked at big tech companies?+
Yes. DE Shaw has a track record with this problem, and the 54% acceptance rate suggests it's actively filtered for strong problem-solving, not rote memorization. It's not a warmup question.
What's the real trick I'm missing?+
Fix the minimum element first, then greedily select the k largest elements to maximize sum. Sort the array and iterate backwards or forwards through each candidate minimum. Use a min-heap to track the top k values seen so far and compute the score.
How does Heap relate to this problem?+
The heap efficiently maintains the k largest elements as you iterate. Without it, finding the top k elements at each step would be O(n^2). The heap keeps insertion, deletion, and access to the minimum in log time, which is why the overall solution stays O(n log n).
Does sorting break the subsequence property?+
No. A subsequence doesn't require elements to stay in original order. Sorting is a preprocessing step that lets you reason about which elements should pair with which minimum. The final result is still a valid subsequence of the original array.
Want the actual problem statement? View "Maximum Subsequence Score" on LeetCode →