Given the head of a singly linked list, reverse the list and return the new head. Example: becomes .
You're implementing the most fundamental linked list problem. If you can't reverse a list, you can't pass a coding interview.
The iterative solution requires careful pointer manipulation. The recursive solution reveals how the call stack can replace explicit pointers. Constraints: up to nodes, values from to .