Reverse Linked List
Given the head of a singly linked list, reverse the list, and return the reversed list.
Reverse Linked List

Given the head of a singly linked list, reverse the list, and return the reversed list.

Example 1:
Input: {"head":[1,2,3,4,5]}
Output: [5,4,3,2,1]
Input
arr ={"head":[1,2,3,4,5]}

Init: prev = null, curr = head

curr

1

2

3

4

5

NULL

prev → NULL

nxt → NULL

Variables
No variables to display
DepthFunction Call
Stack empty
0/26