


The first line of input contains an integer ‘T’, the number of test cases.
The first line of each test case contains the linked list separated by space and terminated by -1.
The second line of each test case contains two space-separated integers, representing the ‘LOW’ and ‘HIGH’ integers, respectively.
For each test case, print the updated linked list.
Output for each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 3*10^3
1 <= LOW <= RIGHT <= N
Time Limit: 1 sec
The basic idea is to traverse the linked list recursively until we reach ‘LOW’ in our linked list. Then we will reverse the linked list by changing the pointers.
Here is the algorithm :
The idea is to iteratively traverse till the node present at position ‘LOW’ while decreasing the ‘LOW’ and ‘HIGH’ integers. Then we will reverse the linked list till ‘HIGH’ is greater than zero. After reversing, we will change the pointers adjacent to the reversed linked list after reversing to get the resultant linked list.
Here is the algorithm :
Sorted Doubly Linked List to Balanced BST
Longest Substring with K-Repeating Characters
Expression Add Operators
Gray Code Transformation
Count of Subsequences with Given Sum