https://support.leetcode.com/hc/en-us/articles/360011833974-What-are-the-environments-for-the-programming-languages-

JavaScript node.js 16.13.2 Your code is run with —harmony flag, enabling new ES6 features.
lodash.js library is included by default.
For Priority Queue / Queue data structures, you may use datastructures-js/priority-queue and datastructures-js/queue.

支持ES6

支持lodash

支持队列

queue

priority-queue

  1. let pq = new MinPriorityQueue();
  2. pq.enqueue(4);
  3. pq.dequeue(); // { priority: 4, element: 4 }

练习: