Back to problems Solve on LeetCode → ← Prev: Cycle Detection

Reverse a Linked List

In-Place Pointer Reversal — Three-Pointer Technique

LeetCode 206 • Easy • Linked Lists

Input: [1, 2, 3, 4, 5]  →  Output: [5, 4, 3, 2, 1]

Time O(n) traverse list once
Space O(1) only 3 pointers
Reversed: 0/5 Pointers: prev, curr, next
prev
current
next_temp
Reversed link
Original link
Ready
Press Play to watch the reversal, or Step to advance one sub-step at a time.
Three pointers (prev, current, next_temp) walk through the list, flipping each arrow as they go.