The Question
CodingReverse Linked List
Given the head of a singly linked list, reverse the list in-place and return the head of the reversed list. You should implement the solution with $O(1)$ auxiliary space and $O(n)$ time complexity. Consider both iterative and recursive approaches, noting the trade-offs between them.
Constraints:
- The number of nodes in the list is in the range [0, 5000].
- Node values are between -5000 and 5000.
C++
Iterative Pointer Reversal
Singly Linked List