Loading...
Loading...
Loading...
A playlist of track numbers is stored as a linked list. Reverse the list by changing the links and print the values in the new order.
Example
Input
1 2 3 4
Output
4 3 2 1
Try the problem first. Open one hint at a time.
Keep prev and node, and save node.next before changing it.
The new head is prev when the loop ends.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor