Reverse a Singly Linked List

Reverse the singly linked list and return the head of the reversed linked list.

Statement

Given the head of a singly linked list, reverse the linked list and return its new or updated head.

Example

Consider the following linked list:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.