DSA Key Problems

Last Stone Weight

Given stone weights, repeatedly smash the two heaviest stones, destroying equal stones or replacing unequal stones by their weight difference, and return the final remaining weight or 0.