Reverse a Linked List

Reverse a Singly Linked List

Given the head node head of a singly linked list, reverse the list in place and return the new head.

The node is defined as:

ListNode:
    val: int
    nex...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: