Ruizheng Wu

Results 3 comments of Ruizheng Wu

JS代码供参考 ``` class Node{ constructor(key,value){ this.key = key this.value = value } } class DoubleList{ constructor(){ // 头、尾的虚拟节点 this.head = new Node(0,0) this.tail = new Node(0,0) this.head.next = this.tail this.tail.prev...

上面代码没有把 makeRecently、addRecently 这些方法提出来,直接在LRU的get、put方法里操作 hashMap和双向链表了 不过应该还算能看懂(js真的..优先级队列、哈希链表都必须纯手撸 还是java刷题比较友好

第一题文章里只给了一个模板,没有给出对应原题的题解,如果不仔细看原题,只看文章的话,可能会感觉比较困惑,建议做的时候细品原题题干~ 给一个labuladong思路的 JS版本 ```js /** * @param {number[]} nums1 * @param {number[]} nums2 * @return {number[]} */ var nextGreaterElement = function(nums1, nums2) { let hash = new Map() let res...