Easy
Reverse a singly linked list.
Given the head of a singly linked list, reverse the list and return the new head.
Examples
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Constraints
- List may be empty
Coding Challenge
Reverse a singly linked list.
Given the head of a singly linked list, reverse the list and return the new head.
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Preparing your coding workspace...