C++ || dear deleted node, rest in peace :)
Approach 1: actually delete the removed node\n\nThis solution is similar to many others, with one difference: actually delete the removed node. :)\n\ncpp\n    L
### Approach 1: actually delete the removed node\n\nThis solution is similar to many others, with one difference: actually delete the removed node. :)\n\n```cpp\n    ListNode* removeNthFromEnd(ListNode* head, int n) {\n        ListNode prehead(-1, head);\n        ListNode* prev = &prehead;\n        for (int i = 0; i < n; ++i) {\n            head = head->next;\n        }\n        while (head) {\n            head = head->next;\n            prev = prev->next;\n        }\n        ListNode* rip = prev->next;\n        prev->next = prev->next->next;\n        // Don\'t be that person that leaks memory. :)\n        delete rip;\n        return prehead.next;\n    }\n```\n\n_As always: Feedback, questions, and comments are welcome._\n\n**p.s. Join us on the [LeetCode The Hard Way Discord Server](https://discord.gg/Nqm4jJcyBf)!**
['Linked List', 'Two Pointers', 'C']