diff --git a/problems/0707.设计链表.md b/problems/0707.设计链表.md index 86f3a683..37ce15ad 100644 --- a/problems/0707.设计链表.md +++ b/problems/0707.设计链表.md @@ -973,6 +973,10 @@ class MyLinkedList { // 处理头节点 if (index === 0) { this.head = this.head!.next; + // 如果链表中只有一个元素,删除头节点后,需要处理尾节点 + if (index === this.size - 1) { + this.tail = null + } this.size--; return; }