修正【0707-设计链表.md】TypeScript代码

This commit is contained in:
zhuye
2022-04-06 23:30:18 +08:00
parent 1e6ec2d32a
commit 31800730a2

View File

@ -973,6 +973,7 @@ class MyLinkedList {
// 处理头节点
if (index === 0) {
this.head = this.head!.next;
// 如果链表中只有一个元素,删除头节点后,需要处理尾节点
if (index === this.size - 1) {
this.tail = null
}