1. Given a singly linklist, Reverse a linkedlist from position starting position to end position. 2. Do it in one-pass. without using any extra space. 3. Indexing start from numeric 1.
Input Format
8->8->14->1->10->12->null 3 5
Output Format
8->8->10->1->14->12->null
Constraints
1 <= size Of LinkedList <= 10^6 1 <= starting Position, ending Position <= 10^6
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
6 8 8 14 1 10 12 3 5
Output
8 8 10 1 14 12