Problem
Given the head of a singly linked list, reverse the list and return the new head. Do it in place, without creating new nodes.
Examples
Input: 1 → 2 → 3 → 4
Output: 4 → 3 → 2 → 1
Input: ∅ (empty list)
Output: ∅
Hints
Try it first. Every hint reveals a bit more.