Shu-How Zの小窝

Loading...
摘要: 集合是什么?一种无序且唯一的数据结构。ES6中有集合,名为Set。集合的常用操作:去重、判断某元素是否在集合中、求交集 let arr=[1,2,2,4,5,6,7,8,9,10] let unRepeat=[...new Set(arr)] console.log(unRepeat) let se 阅读全文
posted @ 2025-01-10 22:41 KooTeam 阅读(15) 评论(0) 推荐(0)
摘要: // 双指针 快+1=慢 true class ListNode { constructor(val, next) { this.val = (val undefined ? 0 : val) this.next = (next undefined ? null : next) } } var ha 阅读全文
posted @ 2025-01-10 21:32 KooTeam 阅读(12) 评论(0) 推荐(0)
摘要: LeetCode:83.删除排序链表中的重复元素 class ListNode { constructor(val, next) { this.val = (val undefined ? 0 : val) this.next = (next undefined ? null : next) } } 阅读全文
posted @ 2025-01-10 21:11 KooTeam 阅读(21) 评论(0) 推荐(0)
摘要: 2.两数相加 class ListNode { constructor(val, next) { this.val = (val undefined ? 0 : val) this.next = (next undefined ? null : next) } } /** * @param {Lis 阅读全文
posted @ 2025-01-10 18:37 KooTeam 阅读(15) 评论(0) 推荐(0)
摘要: flowchart TD A[开始] --> B{p1 是否为空} B -->|No| C[保存 p1.next 到 temp] C --> D[将 p1.next 指向 p2] D --> E[更新 p2 为 p1] E --> F[更新 p1 为 temp] F --> B B -->|Yes| 阅读全文
posted @ 2025-01-10 16:16 KooTeam 阅读(11) 评论(0) 推荐(0)
摘要: 237.删除链表中的节点 /** * Definition for singly-linked list. * function ListNode(val) { * this.val = val; * this.next = null; * } */ /** * @param {ListNode} 阅读全文
posted @ 2025-01-10 15:34 KooTeam 阅读(10) 评论(0) 推荐(0)
摘要: var RecentCounter = function() { this.queue=[] }; /** * @param {number} t * @return {number} */ RecentCounter.prototype.ping = function(t) { this.queu 阅读全文
posted @ 2025-01-10 14:31 KooTeam 阅读(19) 评论(0) 推荐(0)