Easy
You are given stones weights. Each turn, smash the two heaviest together: if equal both are destroyed, else the lighter is destroyed and the heavier becomes their difference. Return the weight of the last remaining stone, or 0 if none remain.
Input: stones = [2,7,4,1,8,1] Output: 1
Input: stones = [1] Output: 1