827. Reverse Linked List
Given the head of a singly linked list, reverse the order of the nodes and return the reversed list.
The input consists of an integer N, representing the number of nodes in the linked list. The next line contains N space-separated integers, which are the values of the nodes.
Print the reversed linked list, with the values of the nodes separated by a space.
3 1 2 3
3 2 1
The number of nodes in the linked list falls within the range of 0 to 5000. Each node's value is an integer between -5000 and 5000.