In‐place reversal of LL - rFronteddu/general_wiki GitHub Wiki
Easy: Fundamentals & Prerequisites
These problems build the foundational muscle memory for rewiring pointers and traversing lists without using extra memory.
- Reverse Linked List Master doing this iteratively using three pointers (prev, curr, next) for O(1) space.
- Palindrome Linked List To solve this in O(1) space, you must find the middle and reverse the second half in-place before comparing.
- Middle of the Linked List The essential first step for any partial reversal problem (like palindromes or reordering). Teaches the fast/slow pointer technique.
- Merge Two Sorted Lists purely in-place.
- Intersection of Two Linked Lists
Medium: Sublists & Complex Rewiring
- Reverse Linked List II must reverse nodes strictly from position left to right while keeping the edges connected to the unreversed sections.
- Reorder List You have to find the middle (876), reverse the second half (206), and then interweave the two lists in-place.
- Swap Nodes in Pairs You are effectively reversing sublists of length 2 throughout the entire list.
- Maximum Twin Sum of a Linked List
- Odd Even Linked List You must carefully sever and reconnect alternating nodes into two separate lists, then merge them.
- Reverse Nodes in Even Length Groups
- Copy List with Random Pointer the optimal O(1) space solution is a masterclass in in-place manipulation—requiring you to weave cloned nodes into the original list and then carefully unweave them.
Hard: Advanced Manipulation
Hard linked list problems generally require you to maintain multiple overlapping pointers while performing repeating, complex sub-operations.
- Reverse Nodes in k-Group You must repeatedly reverse sublists of size k while perfectly maintaining the connecting edges for the previous and next groups.
- Merge k Sorted Lists Solving this optimally with Divide and Conquer requires merging lists completely in-place, testing your ability to manage pointers dynamically at scale.
- LFU Cache implementing this optimally requires building and manually wiring a complex 2D Doubly Linked List purely in-place, pushing your pointer tracking to the limit.