Javascript simple O(nlogn) solution
\nvar lastStoneWeight = function(stones) {\n    if(!stones || stones.length == 0) return 0\n    \n    while(stones.length > 1) {\n        stones.sort((a, b) => 
```\nvar lastStoneWeight = function(stones) {\n    if(!stones || stones.length == 0) return 0\n    \n    while(stones.length > 1) {\n        stones.sort((a, b) => b - a)\n        let x = stones.shift() - stones.shift()\n        stones.push(x)\n    }\n    \n    return stones[0]\n};\n```
['Sorting', 'JavaScript']