Simple one pass 4ms C++ implementation
class Solution {\n    public:\n        ListNode* removeNthFromEnd(ListNode* head, int n) {\n            ListNode realHead(0);\n            realHead.next = head;
    class Solution {\n    public:\n        ListNode* removeNthFromEnd(ListNode* head, int n) {\n            ListNode realHead(0);\n            realHead.next = head;\n            head = &realHead;\n            ListNode *curr = &realHead;\n            while (n-- > 0)\n                curr = curr->next;\n            while (curr->next != nullptr) {\n                curr = curr->next;\n                head = head->next;\n            }\n    \n            head->next = head->next->next;\n            return realHead.next;\n        }\n    };
[]