From 99ff6dd216589b9e9eaa4f1945fe2dc39c44bba8 Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 17 Dec 2021 20:50:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86707=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E9=93=BE=E8=A1=A8javascript=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=A2=98=E8=A7=A3=E7=9A=84=E5=88=A0=E9=99=A4=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" | 4 ++++ 1 file changed, 4 insertions(+) diff --git "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" index 145efa18de..4f2938bcfe 100644 --- "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" +++ "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" @@ -847,6 +847,10 @@ MyLinkedList.prototype.deleteAtIndex = function(index) { if(index < 0 || index >= this._size) return; if(index === 0) { this._head = this._head.next; + // 如果删除的这个节点同时是尾节点,要处理尾节点 + if(index === this._size - 1){ + this._tail = this._head + } this._size--; return; }