```
int k = 0;
ListNode dummyHead(0);
dummyHead.next = head;
ListNode *p,*q;
p = &dummyHead;
q = &dummyHead;
if (head == NULL)
return head;
while (p != NULL)
{
k++;
p = p->next;
}
k = k-n;
while (q != NULL && k>0)
{
k--;
q = q->next;
}
q->next = q->next->next;
return dummyHead.next;
```