Problem
Given thehead of a singly linked list, reverse the list, and return the reversed list.
Examples
Constraints
- The number of nodes in the list is the range
[0, 5000]. -5000 <= Node.val <= 5000
Tested Python solution for LeetCode 206 with 15 pytest cases. Generate a practice environment with lcpy.
head of a singly linked list, reverse the list, and return the reversed list.
[0, 5000].-5000 <= Node.val <= 5000