Challenge: Reverse a Linked List
Can we implement a program that could reverse a linked list? Let's find out.
We'll cover the following
Problem Statement
You have to write the reverse
function, which takes a singly linked list and reverses that list in place.
Input
A singly linked list.
Output
The reversed linked list.
Note: You have to modify the given linked list.
Sample Input
LinkedList = 0->1->2->3-4
Sample Output
LinkedList = 4->3->2->1->0
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy