Example 1 : Reverse linked list

TopicDifficultyCompanies
Array and Linked-List
EASY
Microsoft
Amazon

Write a program to reverse a singly linked list.

Example

Input: 1->12->33->4->15->NULL
Output: 15->4->33->12->1->NULL
Explanation: After reversing, 1->12->33->4->15->NULL becomes 15->4->33->12->1->NULL

Code Editor

Practice and Learn

Best way to learn is through solving real problems. Practice this problem in this code editor.