vd17accc
Search for a command to run...
Given the head of a singly linked list, reverse the list and return the new head.
You must do this iteratively or recursively.
Constraints:
The number of nodes in the list is in the range [0, 5000]
-5000 β€ Node.val β€ 5000
Example 1
[1, 2, 3, 4, 5]
[5,4,3,2,1]