0092. Reverse Linked List II
Last updated
Last updated
https://leetcode.com/problems/reverse-linked-list-ii
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?
12/25/2017 when struture change, use dummy node