[JavaScript] Easy to understand - 2 solutions - 72ms
The first solution, it\'s a normal one, and I think it\'s more in line with the requirements "NOT modify the node". Here is the algorithm:\n\n1. Traversal the l
The first solution, it\'s a normal one, and I think it\'s more in line with the requirements "NOT modify the node". Here is the algorithm:\n\n1. Traversal the linked list to find the middle node\n2. Reverse the latter half\n3. Reorder the whole linked list\n\n```js\nconst reorderList = head => {\n  if (!head || !head.next || !head.next.next) return head;\n\n  let slow = head;\n  let fast = head.next;\n  while (fast && fast.next) {\n    slow = slow.next;\n    fast = fast.next.next;\n  }\n\n  let prev = slow.next;\n  let tail = prev.next;\n  while (tail) {\n    const next = tail.next;\n    tail.next = prev;\n    prev = tail;\n    tail = next;\n  }\n  slow.next.next = null;\n  slow.next = prev;\n\n  let left = head;\n  let right = slow.next;\n  slow.next = null;\n  while (left && right) {\n    const ln = left.next;\n    const rn = right.next;\n    left.next = right;\n    right.next = ln;\n    left = ln;\n    right = rn;\n  }\n\n  return head;\n};\n```\n\nThe second solution, may be a little cheating, by which I mean I add a pointer for each node link to the previous one. I\'m not pretty sure that it\'s modify the values of node or not. And here\'s the algorithm:\n\n1. Traversal the linked list and convert it to a doubly linked list\n2. Reorder the whole linked list from both 2 side\n\n```js\nconst reorderList = head => {\n  if (!head || !head.next) return head;\n  let prev = head;\n  let tail = head.next;\n  while (tail) {\n    tail.prev = prev;\n    prev = tail;\n    tail = tail.next;\n  }\n  let cur = head;\n  while (cur !== prev && cur.prev !== prev) {\n    const next = cur.next;\n    cur.next = prev;\n    prev.next = next;\n    prev = prev.prev;\n    cur = next;\n  }\n  cur.next = null;\n  return head;\n};\n```
['JavaScript']