Update 0019.删除链表的倒数第N个节点.md
This commit is contained in:
parent
28460715b6
commit
87c505371d
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue