You are given an array of integers `stones` where `stones[i]` is the weight of the i-th stone.
On each turn, choose the **two heaviest** stones and smash them together. Suppose the stones have weights `x` and `y` with `x <= y`:
- If `x == y`, both stones are destroyed.
- If `x != y`, the stone of weight `x` is destroyed, and the stone of weight `y` now has weight `y - x`.
At the end of the game, there is **at most one** stone left. Return the weight of the last remaining stone, or `0` if there are no stones left.
Example 1
Input:stones = [2,7,4,1,8,1]
Output:1
Explanation:Smash 8 and 7 -> 1. Smash 4 and 2 -> 2. Smash 2 and 1 -> 1. Smash 1 and 1 -> 0. One stone of weight 1 remains.