Stone Smashing Game
You have a collection of stones, each with its own weight. In each round of the game, you choose the two heaviest stones and smash them together. If both stones have the same weight, they both break. If they have different weights, the lighter stone is destroyed, and the heavier stone's weight is reduced by the weight of the lighter stone.
Your task is to find the weight of the last stone remaining after all the smashing rounds.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)