Java Priority Queue
\npublic int lastStoneWeight(int[] stones) {\n        PriorityQueue<Integer> queue = new PriorityQueue<>(Comparator.reverseOrder());\n        for (int stone : s
```\npublic int lastStoneWeight(int[] stones) {\n        PriorityQueue<Integer> queue = new PriorityQueue<>(Comparator.reverseOrder());\n        for (int stone : stones) {\n            queue.offer(stone);\n        }\n\n        while (queue.size() > 1) {\n            queue.offer(queue.poll() - queue.poll());\n        }\n\n        return queue.isEmpty() ? 0 : queue.peek();\n    }\n```
['Java']