JavaScript
\nvar removeNthFromEnd = function(head, n) {\n  let root = head;\n  let clone = head;\n  let len = 0;\n \n  while (clone) {\n    len++;\n    clone = clone.next;
```\nvar removeNthFromEnd = function(head, n) {\n  let root = head;\n  let clone = head;\n  let len = 0;\n \n  while (clone) {\n    len++;\n    clone = clone.next;\n  }\n  \n  let count = len - n;\n  if (count === 0) return head.next;\n  while (root && count > 1) {\n    root = root.next;\n    count--;\n  }\n\n  root.next = root.next && root.next.next;\n  return head;\n};\n```\n\n```\nvar removeNthFromEnd = function(head, n) {\n  const help = (root, count) => {\n    if (root.next) count = help(root.next, count);\n    \n    if (count === n) root.next = root.next.next;\n    return ++count;\n  }\n  const count = help(head, 0);\n  return count === n ? head.next : head;\n};\n```\n\n```\nvar removeNthFromEnd = function(head, n) {\n  const root = new ListNode(0);\n  root.next = head;\n  let front = root;\n  let back = root;\n  while (n >= 0) {\n    front = front.next;\n    n--;\n  }\n  while (front) {\n    front = front.next;\n    back = back.next;\n  }\n  back.next = back.next.next;\n  return root.next;\n};\n```
[]