# leetcode 019 —— Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.

For example,

   Given linked list: 1->2->3->4->5, and n = 2.

After removing the second node from the end, the linked list becomes 1->2->3->5.

class Solution {
public:
ListNode* removeNthFromEnd(ListNode* head, int n) {
int move = heightOfList(head) - n;  //移动次数
ListNode pre(0);
ListNode *p=⪯
while (move){
start = start->next;
p = p->next;
move--;
}
p->next = start->next;
delete(start);
return (&pre)->next;
}
int n = 0;
n++;
}
return n;
}
};

#### [LeetCode] 019. Remove Nth Node From End of List (Easy) (C++/Python)

2015-03-04 19:26:10

#### [leetcode] 19. Remove Nth Node From End of List python实现【easy】

2016-06-14 21:50:21

#### 【LeetCode-面试算法经典-Java实现】【019-Remove Nth Node From End of List（移除单链表的倒数第N个节点）】

2015-07-22 07:24:29

#### LeetCode 19 : Remove Nth Node From End of List (Java)

2015-12-01 20:02:39

#### （Java）LeetCode-19. Remove Nth Node From End of List

2016-05-31 00:00:58

#### 【LeetCode】19 Remove Nth Node From End of List （c++实现）

2015-07-22 10:29:58

#### LeetCode:Remove Nth Node From End of List

2014-11-18 10:08:28

#### LeetCode 19 — Remove Nth Node From End of List（C++ Java Python）

2014-02-23 12:00:32

#### [C语言][LeetCode][19]Remove Nth Node From End of List

2016-03-07 23:05:04

#### Lintcode174 Remove Nth Node From End of List solution 题解

2017-12-08 17:32:50