阿五

Results 15 comments of 阿五

感觉对象数组应该挺好实现的,每次调用get方法获取数据或者put方法更新数据,都会将数据队列顺序都更新了,需要注意的是,put方法,需要判断**当前队列长度是否超过缓存容量长度、是否是队列中已有的key**这些问题,然后做对应操作。 这一切都是基于我理解的这个put方法应该是可以更新原有数据的。 ```js class LRUCache{ constructor(max){ this.max = max; this.stack = []; } // 当前队列的长度 get __length(){ return this.stack.length; } // 查找元素下标 _findIdx(key){ const {stack} = this; for(let i=0; i

我这个就稍微麻烦了点 ```js var mergeTwoLists = function(l1, l2) { let res = new List(); while(l1 !== null && l2 !== null){ if(l1.element < l2.element){ res.append(l1.element); l1 = l1.next; }else{ res.append(l2.element); l2...

```js const getIntersection = (nums1, nums2) => { return Array.from(new Set(nums1.filter(item => !!~nums2.indexOf(item)))); } ```

> ``` > var fn = (nums1, nums2) => { > var small = nums1, big = nums2; > if (nums1.length > nums2.length) { > small = nums2; > big...

```js function findSumIdx(arr, target){ let num1 = null, num2 = null; for(let i=0; i

万能的`reduce` ```js const getIntersection = (...arrs) => { return Array.from(new Set(arrs.reduce((total, arr) => { return arr.filter(item => total.includes(item)); }))); } ```

我也遇到了这个问题,真的被玩得焦头烂额

这个问题我也遇到了,好像是执行 shell 命令 `cat ~/.clipx` 之后 马上执行的 command v导致的,执行 command v 的时候,还没复制到 ~/.clipx 的内容,就执行了 command v 了,所以会先粘贴一下原本粘贴板上的内容。

I have some issue, and my system is Monterey 12.4