Reorder List

Med
Concept
Code
Loading editor...
Tap Analyze to see visualization
Variables

Run code to see variables

Output

Console output will appear here

Press Space to start to step? all shortcuts

Solution Guide: Reorder List

Approach

Three-step process: (1) find the middle node using slow/fast pointers, (2) reverse the second half of the list in place, (3) merge the two halves by alternating nodes from each. No extra space needed beyond pointers.

Complexity Analysis

Time
O(n)
Space
O(1)

Pattern

Linked List (Find Middle + Reverse + Merge)

Why It Works

Finding the middle splits the list into two equal halves. Reversing the second half lets us pair the first node with the last, second with second-to-last, etc. Alternating merge weaves them into the required order.

Updated Feb 2026