mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
Update 0019.删除链表的倒数第N个节点.md
This commit is contained in:
@ -91,10 +91,6 @@ public ListNode removeNthFromEnd(ListNode head, int n){
|
|||||||
ListNode dummyNode = new ListNode(0);
|
ListNode dummyNode = new ListNode(0);
|
||||||
dummyNode.next = head;
|
dummyNode.next = head;
|
||||||
|
|
||||||
//排除示例 2 的情况:head = [1], n = 1
|
|
||||||
if (head == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
ListNode fastIndex = dummyNode;
|
ListNode fastIndex = dummyNode;
|
||||||
ListNode slowIndex = dummyNode;
|
ListNode slowIndex = dummyNode;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user