mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Update 0019.删除链表的倒数第N个节点.md
This commit is contained in:
@ -75,10 +75,11 @@ public:
|
||||
fast = fast->next;
|
||||
slow = slow->next;
|
||||
}
|
||||
slow->next = slow->next->next;
|
||||
|
||||
ListNode *nth = slow->next;
|
||||
slow->next = nth->next;
|
||||
delete nth;
|
||||
// ListNode *tmp = slow->next; C++释放内存的逻辑
|
||||
// slow->next = tmp->next;
|
||||
// delete nth;
|
||||
|
||||
return dummyHead->next;
|
||||
}
|
||||
|
Reference in New Issue
Block a user