Python solution, one pass
nearly one pass, O(1) space. 44 ms\n\n    def removeNthFromEnd(self, head, n):\n        slow = fast = self\n        self.next = head\n        while fast.next:\n
nearly one pass, O(1) space. 44 ms\n\n    def removeNthFromEnd(self, head, n):\n        slow = fast = self\n        self.next = head\n        while fast.next:\n            if n:\n                n -= 1\n            else:\n                slow = slow.next\n            fast = fast.next\n        slow.next = slow.next.next\n        return self.next   \n\nreal one pass, but O(n) space,  44 ms  \n\n    def removeNthFromEnd(self, head, n):\n        self.next, nodelist  = head, [self]\n        while head.next:\n            if len(nodelist) == n:\n                nodelist.pop(0)\n            nodelist += head,\n            head = head.next\n        nodelist[0].next = nodelist[0].next.next \n        return self.next
['Python']