You are given the head of a singly linked list.
Your task is to reverse this linked list.
Return the head of the newly reversed list.
1 → 2 → 3 → null
3 → 2 → 1 → null
The list is reversed node by node.
1 → 2 → null
2 → 1 → null
A two-node list is reversed.
None
None
An empty list remains empty.
1 → 2 → 3 → null
3 → 2 → 1 → null