✔️ 100% Fastest TypeScript Solution
\n/**\n * Definition for singly-linked list.\n * class ListNode {\n *     val: number\n *     next: ListNode | null\n *     constructor(val?: number, next?: Lis
```\n/**\n * Definition for singly-linked list.\n * class ListNode {\n *     val: number\n *     next: ListNode | null\n *     constructor(val?: number, next?: ListNode | null) {\n *         this.val = (val===undefined ? 0 : val)\n *         this.next = (next===undefined ? null : next)\n *     }\n * }\n */\n\nfunction insertionSortList(head: ListNode | null): ListNode | null {\n  if (!head) return null\n  if (!head.next) return head\n\n  let output = head\n  let curr = head.next\n\n  head.next = null\n\n  while (curr) {\n    const next = curr.next\n    const insertion = curr\n\n    output = insert(output, insertion)\n    curr = next as ListNode\n  }\n\n  return output\n}\n\nfunction insert(head: ListNode, other: ListNode) {\n  let curr = head\n  const val = other.val\n\n  if (val <= head.val) {\n    other.next = head\n    return other\n  }\n\n  while (curr) {\n    if ((val > curr.val && curr.next && val <= curr.next.val) || !curr.next) {\n      other.next = curr.next\n      curr.next = other\n\n      return head\n    }\n\n    curr = curr.next as ListNode\n  }\n\n  return head\n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['TypeScript', 'JavaScript']