Press Play. Step 1: Find middle with slow/fast. Step 2: Split & reverse second half. Step 3: Merge first and second alternately.
TimeO(n)same
SpaceO(n)recursive reverse stack
Recursive: Use recursive reverse for step 2. def reverse(node): if not node or not node.next: return node; new_head = reverse(node.next); node.next.next = node; node.next = None; return new_head
✎ Whiteboard
3
⌨ Type It
Practice until you don't need to look. Use the guide comments below as scaffolding. The green highlights are the nuances to burn into memory.