Intuitive C++ solution. 100% run time, 100% memory.
```class Solution {\npublic:\n    int lastStoneWeight(vector& stones) {        \n        while(stones.size() > 1)\n        {\n            sort(stones.begin(),st
```class Solution {\npublic:\n    int lastStoneWeight(vector<int>& stones) {        \n        while(stones.size() > 1)\n        {\n            sort(stones.begin(),stones.end());\n            int y = stones[stones.size()-1];\n            int x = stones[stones.size()-2];\n            \n            if(x == y)\n            {\n                stones.erase(stones.begin() + stones.size()-1);\n                stones.erase(stones.begin() + stones.size()-1); // removes the two biggest numbers.\n            }\n            else\n            {\n                stones[stones.size()-2] = stones[stones.size()-1] - stones[stones.size()-2];\n                \n                stones.erase(stones.begin() + stones.size()-1);                \n            }\n        }\n        \n        if(stones.size() == 1)\n            return stones[0];\n        \n        return 0;\n    }\n};
[]