Given the head of a singly linked list L0 → L1 → … → Ln-1 → Ln, reorder it in place to L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → … without modifying the values in the list's nodes.
head = [1,2,3,4][1,4,2,3]head = [1,2,3,4,5][1,5,2,4,3]Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →A chain of nodes, each pointing to the next. No random access like an array, but insertion and deletion at a known position is O(1), and many classic problems come down to careful pointer rewiring.
Read the full Linked List guide →
Original problem on LeetCode ↗