Reverse a Linked List

Published by Shreeansh in

Given a linked list class, implement a method called reverse() that reverses the linked list.

Examples

Input: 10 -> 20 -> 30 -> 40 -> None

Output: 40 -> 30 -> 20 -> 10 -> None

Notes

Just implement the reverse() function and DO NOT modify any other code in the Code tab, which has nothing but the starter code.

Watch a quick demo on how Edabit works.