Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e068f9

Browse files
java单链表版本中,因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
1 parent 843c3f7 commit 0e068f9

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
@@ -365,10 +365,7 @@ class MyLinkedList {
365365
return;
366366
}
367367
size--;
368-
if (index == 0) {
369-
head = head.next;
370-
return;
371-
}
368+
//因为有虚拟头节点,所以不用对Index=0的情况进行特殊处理
372369
ListNode pred = head;
373370
for (int i = 0; i < index ; i++) {
374371
pred = pred.next;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /