Skip to main content
← Problem catalogue Understand the pattern. Try it yourself. Review the solution. Practice this pattern →
Medium Linked List Medium frequency Solution Available Practice Mode

Reorder List LeetCode Solution

Tags: #Linked List #Two Pointers #Stack

Approach Summary

Three steps: find middle with slow/fast pointers, reverse the second half, merge two halves alternately.

Practice Mode 2 Progressive Approaches

Solve it yourself before revealing the code

DSA interviews test reasoning from brute force to optimal. Think through the constraints first.

Algorithmic Pattern

Master the Linked List Pattern

View Pattern Guide →

Study the core invariant, step-by-step decision framework, and common interview traps for the Linked List pattern.

Framework: Linked List • Interview Prep: Tested at FAANG • Explore all Linked List problems & invariants →

How to Recognize This Pattern

  • Interleave first half with reversed second half

Complexity Analysis

Time Complexity

O(n)

Space Complexity

O(1)

Tags

Linked List Two Pointers Stack

Frequently Asked Questions

What is the optimal time and space complexity for Reorder List?
The optimal solution for Reorder List achieves O(n) runtime complexity and requires O(1) auxiliary space. Time complexity is O(n) because finding the middle takes n/2 steps, reversing the second half takes n/2 steps, and merging takes n steps. Space complexity is O(1) as all transformations are performed purely by re-linking existing node pointers.
How do I identify that Reorder List requires the Linked List pattern?
In technical interviews, look for key problem signals: Interleave first half with reversed second half. Recognizing these invariants allows you to bypass naive brute-force exhaustive search in favor of Linked List strategy.
What critical edge cases must be handled in Reorder List?
Essential edge cases to verify include: Empty list or single node list (e.g. head == null or head.next == null; returns immediately); Even number of nodes (e.g. 1 -> 2 -> 3 -> 4 becomes 1 -> 4 -> 2 -> 3); Odd number of nodes (e.g. 1 -> 2 -> 3 -> 4 -> 5 becomes 1 -> 5 -> 2 -> 4 -> 3); Two node list (1 -> 2 stays 1 -> 2). Always walk through these scenarios with your interviewer before coding.
Which tech companies frequently ask Reorder List?
Reorder List is a Medium-difficulty question tagged with medium recurrence. It is actively asked in technical screening and onsite interview loops at Amazon, Facebook.
Buy me a coffee
Daily Practice
0/0