Skip to content

Commit 0828601

Browse files
Merge pull request youngyangyang04#2589 from WuTao1103/master
java单链表版本中,因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
2 parents 78e6286 + 47ecc81 commit 0828601

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

problems/0707.设计链表.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,7 @@ class MyLinkedList {
380380
return;
381381
}
382382
size--;
383-
if (index == 0) {
384-
head = head.next;
385-
return;
386-
}
383+
//因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
387384
ListNode pred = head;
388385
for (int i = 0; i < index ; i++) {
389386
pred = pred.next;

0 commit comments

Comments
 (0)