C++ solution, easy to understand with explanations.
Renewed Solution \n\nThe difference between the final node and the to_be_delete node is N. And here the assumption is that n is always valid.\n\nfast pointer po
<h1>Renewed Solution</h1>\n\nThe difference between the final node and the `to_be_delete` node is N. And here the assumption is that n is <b>always</b> valid.\n\n`fast` pointer points to the node which is N step away from the `to_be_delete` node.<br>\n`slow` pointer points to the `to_be_delete` node.\n\nThe algorithms is described as below:\n\n<b>Firstly</b>, move `fast` pointer N step forward.<br>\n<b>Secondly</b>,move `fast` and `slow` pointers simultaneously <b>one step a time</b> forward till the `fast` pointer reach the end, which will cause the `slow` pointer points to the previous node of the `to_be_delete` node.\n\n<b>Finally</b>, `slow->next = slow->next->next`.\n\n    ListNode *removeNthFromEnd(ListNode *head, int n) \n    {\n        if (!head)\n            return nullptr;\n    \n        ListNode new_head(-1);\n        new_head.next = head;\n\n        ListNode *slow = &new_head, *fast = &new_head;\n\n        for (int i = 0; i < n; i++)\n            fast = fast->next;\n\n        while (fast->next) \n        {\n            fast = fast->next;\n            slow = slow->next;\n        }\n\n        ListNode *to_de_deleted = slow->next;\n        slow->next = slow->next->next;\n        \n        delete to_be_deleted;\n\n        return new_head.next;\n    }\n**Fixed : Added code for deleting the N-th node.**
['C++']