# Reverse [[linked-list|Linked List]] https://leetcode.com/problems/reverse-linked-list/ ```python prev = None curr = head while curr: next_temp = curr.next curr.next = prev prev = curr curr = next_temp return prev ``` A shorter version ```python prev, curr = None, head while curr: curr.next, prev, curr = prev, curr, curr.next ``` There's not need to use a stack! Alternatively, use recursion. ```python if not head or not head.next: return head p = self.reverseList(head.next) head.next.next = head head.next = None return p ```