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
Topic | Difficulty | Companies |
---|---|---|
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