class Solution {
public:
ListNode* removeNthFromEnd(ListNode* head, int n) {
ListNode* first = head;
ListNode* second = head;
int count = n;
while(count != 0){
first = first->next;
count--;
}
if(first == NULL)
return head->next;
while(first->next != NULL){
first = first->next;
second = second->next;
}
second->next = second->next->next;
return head;
}
};