Java Solution using PriorityQueue
Store all elements in the Priority Queue in decreasing order.\n Each time, poll 2 elements from the Priority Queue until its size is 1 and add the absolute diff
* Store all elements in the Priority Queue in decreasing order.\n* Each time, poll 2 elements from the Priority Queue until its size is 1 and add the absolute difference between the 2 elements back to the queue.\n* Return 0 if the PriorityQueue is empty or return the last element remaining in the PriorityQueue\n```\npublic int lastStoneWeight(int[] stones) {\n        if(stones == null || stones.length == 0)\n            return 0;\n        PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder());\n        for(int i = 0; i < stones.length; i++)\n            pq.add(stones[i]);\n        while(pq.size() > 1) {\n            int a = pq.poll();\n            int b = pq.poll();\n            if(a - b != 0)\n                pq.add(Math.abs(a - b));\n        }\n        if(pq.size() == 1)\n            return pq.poll();\n        else\n            return 0;\n    }\n```\n
[]