Last Stone Weight
A easy-tier problem at 66% community acceptance, tagged with Array, Heap (Priority Queue). Reported in interviews at Nvidia and 3 others.
Last Stone Weight looks deceptively simple but trips up candidates who don't recognize the heap pattern. You're given an array of stone weights. Each turn, you pick the two heaviest stones, smash them together, and if they differ, the remainder goes back in the pile. Last stone wins. Nvidia, PayPal, and Rippling have all asked this. The 66% acceptance rate is misleading, people who see the heap trick solve it fast. People who don't, don't. If you blank on the pattern mid-OA and need a working solution invisibly fast, that's where your safety net comes in.
Companies that ask "Last Stone Weight"
Last Stone Weight 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 trap is trying to simulate with arrays and sorting repeatedly. You'll time out or write messy code. The pattern: use a max heap (priority queue). Pop the two heaviest, compare them, push the remainder back. Repeat until one or zero stones remain. Python's heapq is a min heap, so negate weights. The algorithm is O(n log n) for building the heap, then O(n log n) for the smashing loop. Most failures come from either not recognizing heap as the data structure or implementing the heap operations wrong. This is a Heap topic, which means it's testing whether you can spot when a greedy 'always pick the max' strategy needs heap backing. On your live OA, if you hesitate between array simulation and heap, StealthCoder surfaces the heap solution in seconds and you move on.
Pattern tags
You know the problem.
Make sure you actually pass it.
Last Stone Weight 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.
Last Stone Weight interview FAQ
Why is this tagged 'easy' when people get it wrong in interviews?+
66% acceptance is high, but most of those are people grinding LeetCode who've already learned 'max operation repeatedly = heap'. In a live OA with no prep, the pattern isn't obvious. Easy means the implementation is short once you know the trick, not that the trick is intuitive.
Does Last Stone Weight come up at big tech companies?+
Yes. Nvidia, PayPal, and Rippling all ask it. It's not hyper-frequent, but it's stable across the reporting data. If you see it, you're expected to solve it cleanly.
Can I just sort the array and loop?+
You can simulate it that way, but you'd re-sort after every operation, making it O(n^2 log n). A max heap stays efficient. Interviewers notice the inefficiency and ask you to optimize. Heap is the intended approach.
What's the trick I'm missing?+
The trick is recognizing that you always need the two maximum elements. Once you need the max repeatedly, think heap. Arrays don't give you fast max removal. Heap does in O(log n).
Is Last Stone Weight still asked in 2024?+
Yes. The data shows it across current company reports. It's not trendy, just stable. Heap problems stay relevant because they're fundamental to priority queue logic in real systems.
Want the actual problem statement? View "Last Stone Weight" on LeetCode →