Skip to content

Reorder Linked List ​

Reorder Linked List — LeetCode

Reorder a list L0 -> L1 -> ... -> Ln into L0 -> Ln -> L1 -> Ln-1 -> ... by rearranging the nodes themselves.

Approach ​

  1. Find Middle using Floyd's Rabbit and Turtle Algorithm
  2. Split the list at right midpoint) start $r$ and $t$ at head)
  3. Reverse right half
  4. Carefully join back

Remarks ​

I made a lot of fumbles while joining back