206 Reverse Linked List
206. Reverse Linked List
1. Question
Reverse a singly linked list.
Hint:
A linked list can be reversed either iteratively or recursively. Could you implement both?
2. Implementation
(1) Iterative
3. Time & Space Complexity
Iterative: 时间复杂度O(n), 空间复杂度O(1)
Last updated