C++ naive solution
\nint lastStoneWeight(vector<int>& stones) {\n        sort(stones.begin(),stones.end());\n        int a=stones.size()-1;\n        if(a==0){\n            return 
```\nint lastStoneWeight(vector<int>& stones) {\n        sort(stones.begin(),stones.end());\n        int a=stones.size()-1;\n        if(a==0){\n            return stones[a];\n        }\n        for(int i=0;i<stones.size();i++){\n            sort(stones.begin(),stones.end());\n            if(stones[a]>0 && stones[a-1]>0){\n                stones[a]=stones[a]-stones[a-1];\n                stones[a-1]=0;\n            }\n            else{\n                break;\n            }\n        }\n        return stones[a];\n    }\n\t```
[]