Java | 4 liner | Explained
Idea:\n Push all stones in a max-heap\n Poll two stones, and push their difference back into the heap\n Do this till there\'s only 1 stone left\n\n>T/S: O(n lg 
**Idea:**\n* Push all stones in a max-heap\n* Poll two stones, and push their difference back into the heap\n* Do this till there\'s only 1 stone left\n\n>**T/S:** O(n lg n)/O(n), where n = size(stones)\n```\npublic int lastStoneWeight(int[] stones) {\n\tvar maxHeap = new PriorityQueue<Integer>(Collections.reverseOrder());\n\t\n\tfor (var stone : stones)\n\t\tmaxHeap.add(stone);\n\n\twhile (maxHeap.size() > 1)\n\t\tmaxHeap.offer(maxHeap.poll() - maxHeap.poll());\n\t\t\n\treturn maxHeap.poll();\n}\n```\n***Please upvote if this helps***
['Heap (Priority Queue)', 'Java']