Closed Haris-Mohanty closed 1 year ago
Given the head of a singly linked list, reverse the list and return its head. Write a function or algorithm to solve this problem efficiently.
The head node of a singly linked list.
Return the head node of the reversed linked list.
## Input: 1 -> 2 -> 3 -> 4 -> 5 -> null ## Output: 5 -> 4 -> 3 -> 2 -> 1 -> null
@ayushi-ras, Please assign me this issue.
Problem Description:
Input:
The head node of a singly linked list.
Output:
Return the head node of the reversed linked list.
Example: