Reverse a linked list
MediumLet's say you're given a linked list. Write a function that reverses the linked list.
For example, passing a list with the data
(3) -> (5) -> (6) -> (7)
should return a linked list with pointers reversed: (7) -> (6) -> (5) -> (3)
.Try it first
Solution
8 Essential Linked Lists Coding Interview Problems
Master Linked Lists by trying the coding challenges below.
- 1.Insert NodeEasy
- 2.Remove NodeEasy
- 3.Find the MiddleEasy
- 4.Add Linked ListsEasy
- 5.Reverse Linked ListMedium
- 6.Detect CycleMedium
- 7.Merge Linked ListsMedium
- 8.Pivot Linked ListHard