The shamans of Codetikki weave spirit-chains where each link points to the next. A young shaman must learn to reverse the chain in place. Given the head of a singly linked list, reverse it in-place. The input is given as space-separated values representing the linked list nodes in order. Output the reversed list as space-separated values.
Example 1:
Example 2:
Constraints:
0 <= n <= 10^4 -10^3 <= node value <= 10^3
Tags:
