#13

Reverse Linked List

Easy
All Problems

13. Reverse Linked List#206

Easy🔗 Linked ListPointer Reversal

Reverse a singly linked list.

Examples

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

Why learn this

The most fundamental linked list operation. Teaches pointer manipulation and recursion.

Linked ListsIterationRecursion
Python 3Loading Python engine...
Click "Run Code" to test your solution