MEDIUMasked at 4 companies

Delete and Earn

A medium-tier problem at 57% community acceptance, tagged with Array, Hash Table, Dynamic Programming. Reported in interviews at Akuna Capital and 3 others.

Founder's read

Delete and Earn is a dynamic programming problem that looks simpler than it actually is. You see an array, you think greedy. Then you hit the constraint: if you take a number, all instances of that number plus one get deleted. Suddenly the greedy approach collapses. It's been asked at Akuna Capital, Citadel, Accenture, and Meesho. With a 57% acceptance rate, half the candidates who attempt it miss the DP transition. If you blank on the pattern during your live assessment, StealthCoder surfaces the working solution in seconds while the proctor sees nothing.

Companies asking
4
Difficulty
MEDIUM
Acceptance
57%

Companies that ask "Delete and Earn"

If this hits your live OA

Delete and Earn 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 who got tired of watching his cohort grind for six months and still get filtered at the OA stage.

Get StealthCoder
What this means

The trap is thinking you can just pick the highest numbers. You can't, because deleting adjacents tanks your future options. The real insight is that this reduces to the House Robber pattern once you transform the problem. Group all instances of each number, sum their values, then run DP where you either take a number (and skip the next) or skip it. Most candidates see the array and miss the grouping step entirely. Others group correctly but build the DP table wrong, double-counting values or failing to carry forward the max. This is where live coding falls apart: you're debugging recurrence logic under time pressure. StealthCoder skips the painful iteration and hands you a clean, working solution the moment you're stuck.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Delete and Earn 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 who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Delete and Earn interview FAQ

Is this really a DP problem or can you solve it greedy?+

Pure greedy fails. If you greedily pick the highest number, you may block higher total sums. The DP recurrence lets you compare taking a number (plus everything you could earn before it) versus skipping it. The transition requires memoization or bottom-up DP. Greedy gets you partial credit at best.

How does this relate to House Robber?+

Nearly identical after one step. House Robber chooses houses; Delete and Earn chooses number values. Once you group and sum all instances of each number, you've reduced it to House Robber: at index i, either take nums[i] + dp[i-2] or skip and take dp[i-1]. Same DP table structure.

What's the most common mistake during the live coding?+

Forgetting to sort the unique numbers or skipping the grouping step entirely. Candidates try to run DP directly on the original array, which breaks the recurrence. Others group correctly but initialize the DP table wrong, leading to off-by-one errors. The logic looks close enough that it passes small tests but fails on edge cases.

Is 57% acceptance high or low for a medium problem?+

It's below average for medium difficulty. Most medium problems sit around 60-65%. This one punishes the greedy instinct and the recurrence is easy to botch under pressure. It's definitely a filtering problem at companies like Citadel and Akuna Capital that expect solid DP fundamentals.

Can you solve it in O(1) space?+

Yes. You only need the last two DP values at any point, so use two variables instead of an array. Time stays O(n log n) for sorting; space drops to O(1) excluding the grouping map. This optimization matters in live interviews where you want to show you thought about space complexity.

Want the actual problem statement? View "Delete and Earn" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.