Merge pull request #1601 from starry0819/master
更新 0707.设计链表.md Java示例代码部分功能
This commit is contained in:
commit
6efb90c552
|
|
@ -353,8 +353,12 @@ class MyLinkedList {
|
|||
return;
|
||||
}
|
||||
size--;
|
||||
if (index == 0) {
|
||||
head = head.next;
|
||||
return;
|
||||
}
|
||||
ListNode pred = head;
|
||||
for (int i = 0; i < index; i++) {
|
||||
for (int i = 0; i < index - 1; i++) {
|
||||
pred = pred.next;
|
||||
}
|
||||
pred.next = pred.next.next;
|
||||
|
|
|
|||
Loading…
Reference in New Issue