Reverse an Inner Linked List
Given a singly linked list node
, and integers i
and j
, reverse the linked list from i
to j
th nodes, 0
indexed and inclusive.
You should return the head of the reversed list.
This should be done in \(\mathcal{O}(1)\) space.
Constraints
n ≤ 100,000
wheren
is the number nodes innode
https://binarysearch.com/problems/Reverse-an-Inner-Linked-List
Examples
Example 1
Input
- node =
- i =
1
- j =
2
Output
- answer =
Leave a comment