Question
Given the head of a singly linked list, reverse its links in place and return the new head.
```python
class ListNode:
val: int
next: "ListNode | None"
def reverse_list(head: ListNode | None) -> ListNode | None: ...
```
Do not allocate a second list. An empty list and a one-node list should be returned unchanged. The iterative solution should use `O(1)` auxiliary space.
## Staged follow-ups
1. Provide a recursive implementation and compare its space usage.
2. Reverse only the nodes between positions `left` and `right`.
3. Reverse nodes in fixed-size groups while leaving a final short group unchanged.