Member-only story
Day 21 — Reverse Linked List | Blind 75 | Java
Today’s problem is LeetCode 206 — Reverse Linked List.
Reversing a linked list is one of the most fundamental linked-list problems in coding interviews. It helps build a strong understanding of how next pointers work and introduces two important techniques:
- Iterative reversal using pointers
- Recursive reversal
I also explored a straightforward approach using an extra ArrayList.
Approach 1: Using Extra Space
The simplest approach is to first store all node values in an ArrayList.
We then traverse the linked list again and replace each node’s value with the values from the list in reverse order.
For example:
1 → 2 → 3 → 4 → 5The values are stored as:
[1, 2, 3, 4, 5]Then we write them back in reverse:
5 → 4 → 3 → 2 → 1This approach is easy to understand, but it does not actually reverse the links. Instead, it changes the values stored inside the existing nodes.
Java Code
class Solution {
public ListNode reverseList(ListNode head) {
List<Integer>…





