92. Reverse Linked List II
Medium
Last updated
Medium
Last updated
Given the head
of a singly linked list and two integers left
and right
where left <= right
, reverse the nodes of the list from position left
to position right
, and return the reversed list.
Example 1:
Example 2:
Constraints:
The number of nodes in the list is n
.
1 <= n <= 500
-500 <= Node.val <= 500
1 <= left <= right <= n
Follow up: Could you do it in one pass?
Runtime: 0 ms, faster than 100%
Memory Usage: 2.1 MB, less than 16.81%