#1046

Last Stone Weight

easy· Heap / Priority Queueruns: 0

You are given an array of integers stones where stones[i] is the weight of the ith stone. On each turn, pick the two heaviest stones and smash them. If they are equal in weight, both are destroyed; otherwise the survivor has weight equal to the difference. Return the weight of the last remaining stone, or 0 if none remain.

sign in to paste and practice your own solution
desktop only

codedrill is a typing game and needs a real keyboard. open this on a laptop or desktop to practice.

you can still browse problems and sections from your phone.