19. Remove Nth Node From End of List
struct ListNode* removeNthFromEnd(struct ListNode* head,
int n) {
struct ListNode
*L=(struct ListNode
*)malloc(sizeof(struct ListNode));
L->
next=head;
struct ListNode
*p=L,
*q=L->
next;
while(n--)
q=
q->
next;
while(
q)
{
q=
q->
next;
p=p->
next;
}
q=p->
next;
p->
next=
q->
next;
free(
q);
return L->
next;
}