Skip to content

Commit 99ff6dd

Browse files
committed
修改了707设计链表javascript版本题解的删除节点操作
1 parent d89b396 commit 99ff6dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

problems/0707.设计链表.md

+4
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,10 @@ MyLinkedList.prototype.deleteAtIndex = function(index) {
847847
if(index < 0 || index >= this._size) return;
848848
if(index === 0) {
849849
this._head = this._head.next;
850+
// 如果删除的这个节点同时是尾节点,要处理尾节点
851+
if(index === this._size - 1){
852+
this._tail = this._head
853+
}
850854
this._size--;
851855
return;
852856
}

0 commit comments

Comments
 (0)