Dashboard
LC #206
Reverse Linked List
Pattern · ?AmazonGoogleMetaMicrosoftApple
Problem
Reverse a singly linked list in-place.
Constraints
- 0 ≤ n ≤ 5000
- -5000 ≤ Node.val ≤ 5000
- Both iterative and recursive solutions accepted
Example
- Input
- head = [1, 2, 3, 4, 5]
- Output
- [5, 4, 3, 2, 1]
Spot the pattern
Which pattern cracks it?
Hints
One at a time