mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 21:10:58 +08:00
Merge pull request #1601 from starry0819/master
更新 0707.设计链表.md Java示例代码部分功能
This commit is contained in:
@ -353,8 +353,12 @@ class MyLinkedList {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size--;
|
size--;
|
||||||
|
if (index == 0) {
|
||||||
|
head = head.next;
|
||||||
|
return;
|
||||||
|
}
|
||||||
ListNode pred = head;
|
ListNode pred = head;
|
||||||
for (int i = 0; i < index; i++) {
|
for (int i = 0; i < index - 1; i++) {
|
||||||
pred = pred.next;
|
pred = pred.next;
|
||||||
}
|
}
|
||||||
pred.next = pred.next.next;
|
pred.next = pred.next.next;
|
||||||
|
Reference in New Issue
Block a user