Welcome back.
I have a fun little exercise for you and I know I call every single exercise fine.
But I think this one is especially fun.
Now one of the most popular interview questions when it comes to linked lists is to reverse a linked
list.
What I mean by that.
Well an interviewer is going to say we have a length list here.
How would you go about reversing this list if I have a list over here that is one 10 16 18.
How can you make the list the link list.
Go from 88 to 16 to 10 to 1.
How would you reverse it and flip.
And we're going to use a singly linked list for this exercise and all we want to do is create a new
method.
That is going to say reverse
and this method in here will have to do some magic that will reverse this for us.
Remember we're not just printing out an array we want a reversed linked list that now has 88 referencing
16 that has a reference saying or pointing to 10 and 10 pointing to one and one pointing to no how would
you go about doing this.
Good luck with this exercise and I'll see you in the solution video.
Bye bye.