Reorder a Singly Linked List (L0→Ln→L1→Ln-1→...)
Given the head of a singly linked list, reorder it to:
L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → ...
Requirements:
- Reorder in-place (do not create new nodes).
- Extra space must be
O(1).
I/O forma...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
