原题题目
代码实现(首刷自解)
class Solution {
public:int lastStoneWeight(vector<int>& stones) {
priority_queue<int,vector<int>,less<int>> q;for(const auto& stone:stones) q.emplace(stone);while(q.size() >=2){
int s1 = q.top();q.pop();int s2 = q.top();q.pop();int temp = abs(s1-s2);if(temp) q.emplace(temp);}if(!q.size()) return 0;else return q.top();}
};