Linked List pattern
Reorder List
Given the head of a singly linked list, reorder it in place by interleaving nodes from the front and back so the order becomes first, last, second, second-to-last, and so on. Only the node links may be changed, not the values. Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 143
- Medium
- 2 approaches
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
Linked ListLeetCode 143
Medium
From the first idea to the best one
- 01 Brute force · array of node references O(n)O(n) space
- 02 Optimized · middle + reverse + merge O(n)O(1) space
What you will learn
- How to read Reorder List and spot the linked list pattern in it
- Brute force · array of node references: O(n) time, O(n) space
- Optimized · middle + reverse + merge: O(n) time, O(1) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Linked List
See Reorder List run, step by step
Sign in and this page opens on the animation, with all 9 Linked List problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.