✅C++ ||EASY && SHORT|| Faster than 100% || Priority_queue
\n\nT->O(n) && S->O(n)\n\n\tclass Solution {\n\t\tpublic:\n\t\t\tint lastStoneWeight(vector& st) {\n\t\t\t\tint n=st.size();\n\t\t\t\tpriority_queueq;\n\t\t\t\t
![image](https://assets.leetcode.com/users/images/e3870a6c-2992-4394-80e6-0251c9344bc1_1664696002.4909544.png)\n\n**T->O(n) && S->O(n)**\n\n\tclass Solution {\n\t\tpublic:\n\t\t\tint lastStoneWeight(vector<int>& st) {\n\t\t\t\tint n=st.size();\n\t\t\t\tpriority_queue<int>q;\n\t\t\t\tfor(auto i: st) q.push(i);\n\t\t\t\twhile(q.size()!=1){\n\t\t\t\t\tint x=q.top();\n\t\t\t\t\tq.pop();\n\t\t\t\t\tint y=q.top();\n\t\t\t\t\tq.pop();\n\t\t\t\t\tq.push(max(x,y)-min(x,y));\n\t\t\t\t}\n\t\t\t\treturn q.top();\n\t\t\t}\n\t\t};
['C', 'Heap (Priority Queue)', 'C++']