C++ || 100% || SHORTEST AND EASIEST || Without using any data structure
\n\u2714without using priority_queue\n\u2714all you need to do is sorting the array each time you modify it.\nclass Solution {\npublic:\n    int lastStoneWeight
```\n\u2714without using priority_queue\n\u2714all you need to do is sorting the array each time you modify it.\nclass Solution {\npublic:\n    int lastStoneWeight(vector<int>&s) {\n        sort(s.begin(),s.end());\n        while(s.size()>1){\n            int i=s.size()-1;\n            int x=s[i],y=s[i-1];\n            s.pop_back();\n            s.pop_back();\n            if(x!=y)s.push_back(x-y);\n            sort(s.begin(),s.end());\n        }\n        if(s.size()==0)return 0;\n        return s[0];\n    }\n};\n```\nUPVOTE IF YOU LIKE IT!!\uD83D\uDC4D\uD83D\uDC4D
['Array', 'Sorting']