Super Simple O(N) Java Solution using bucket sort and two pointers
```\nclass Solution {\n    public int lastStoneWeight(int[] stones) {\n        int[] buckets = new int[1001];\n        for (int i = 0; i < stones.length; i++) {
```\nclass Solution {\n    public int lastStoneWeight(int[] stones) {\n        int[] buckets = new int[1001];\n        for (int i = 0; i < stones.length; i++) {\n            buckets[stones[i]]++;\n        }\n\n        int slow = buckets.length - 1;   //start from the big to small\n        while (slow > 0) {\n\t\t// If the number of stones with the same size is even or zero, \n\t\t// these stones can be totally destroyed pair by pair or there is no such size stone existing, \n\t\t// we can just ignore this situation.\n\t\t\n        // When the number of stones with the same size is odd, \n\t\t// there should leave one stone which is to smash with the smaller size one.\n            if (buckets[slow]%2 != 0) {\n                int fast = slow - 1;\n                while (fast > 0 && buckets[fast] == 0) {\n                    fast--;\n                }\n                if (fast == 0) break;\n                buckets[fast]--;\n                buckets[slow - fast]++;\n            }\n            slow--;\n        }\n        return slow;\n    }\n}\n
[]