Merge pull request #2589 from WuTao1103/master
java单链表版本中,因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
This commit is contained in:
commit
08286019d5
|
|
@ -380,10 +380,7 @@ class MyLinkedList {
|
|||
return;
|
||||
}
|
||||
size--;
|
||||
if (index == 0) {
|
||||
head = head.next;
|
||||
return;
|
||||
}
|
||||
//因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
|
||||
ListNode pred = head;
|
||||
for (int i = 0; i < index ; i++) {
|
||||
pred = pred.next;
|
||||
|
|
|
|||
Loading…
Reference in New Issue