Hard · Fast/Slow + Reverse + Merge
Understand → Visualise → Practice.
Reorder L₀ → L₁ → … → Lₙ into L₀ → Lₙ → L₁ → Lₙ₋₁ → … without copying values.
Find the middle, reverse the second half, then weave the two halves node by node.
Use slow and fast pointers to find the middle.
Reverse the second half in place.
Alternate nodes while saving both next pointers.
O(n) time and O(1) extra space.
Split the first half before reversing, or an old next pointer can create a cycle.
Read the full guide first: Linked Lists.
Guest mode lets you understand, visualise and run the sample tests. Create a free account to submit and save your solutions.