Notice Period
visualization

Linked List Reversal

Three pointers, one flip per node, zero extra memory.

list = 3 → 7 → 1 → 9 → 4 · reverse in placestep 1/17
cur3 →7 →1 →9 →4 →

Start: every arrow points right, head is 3. prev is None and cur sits on 3.

pseudocode
prev = None
cur = head
while cur:
next = cur.next # save the escape route
cur.next = prev # flip the arrow
prev, cur = cur, next
return prev # new head