Problem
You get head, the first node of a linked list. A linked list is a chain of nodes, and each node links to the next node.
The list has the nodes L0, L1, ..., Ln. Change the order of the nodes to L0, Ln, L1, Ln-1, L2, Ln-2, .... Thus, the new order uses a node from the start, then a node from the end, and continues in this pattern.
Change only the links between the nodes, and do not change the values in the nodes. Change the list in place. In place means that you change the input list and do not return a value.
Example 1
- Input:
- head = [7,3,9,2]
- Output:
- [7,2,3,9]
- Explanation:
- The new order is the first node, the last node, the second node and then the third node.
Example 2
- Input:
- head = [10,20,30,40,50]
- Output:
- [10,50,20,40,30]
Constraints
- The number of nodes in the list is in the range [1, 5 * 10^4].
- 1 <= Node.val <= 1000
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 143. Reorder List
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source