[Javascript] Simple Priority Queue
\nvar lastStoneWeight = function(stones) {\n    const queue = new MaxPriorityQueue();\n    \n    for (stone of stones) queue.enqueue(stone)\n    \n    while (qu
```\nvar lastStoneWeight = function(stones) {\n    const queue = new MaxPriorityQueue();\n    \n    for (stone of stones) queue.enqueue(stone)\n    \n    while (queue.size() > 1) {\n        let first = queue.dequeue().element;\n        let second = queue.dequeue().element;\n        if (first !== second) queue.enqueue(first-second)\n    }\n    \n    return queue.size() === 0 ? 0 : queue.front().element\n};\n```
['Heap (Priority Queue)', 'JavaScript']