Search⌘ K
AI Features

Solution: Reorder List

Learn to reorder a singly linked list by locating the middle node with two pointers, reversing the latter half, and merging the nodes alternatively. This lesson teaches a linear time and constant space method to manipulate linked list node connections without modifying node values.

Statement

Given the head of a singly linked list, reorder the list as if it were folded on itself. For example, if the list is represented as follows:

L0L_{0} ...