Linked List
TimeO(n)SpaceO(1)
Walk the list with three pointers. Save the next node, flip the current node's pointer to face backward, then advance — reversing the list in a single pass.
Key idea. Three pointers (prev, curr, next) flip each link in place. No extra list — just careful pointer rewiring.
1
Loading…
—