The first line of input contains an integer ‘T’, denoting the number of test cases. Then each test case follows.
The first line of each test case contains the Integer ‘N’ denoting the number of elements in the linked list. The first element is the head of the given linked list.
The second and the last line of each test case contains ‘N’ space-separated integers representing the node value of the linked list.
For each test case, print a single line containing ‘N’ single space-separated integers, the elements of the new linked list.
The output of each test case will be printed on a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 5 * 10 ^ 3
-10 ^ 9 <= nodeVal[i] <= 10 ^ 9
Time Limit: 1 sec.
The idea is to traverse the list till the last node using two pointers, one to store the address of the last node and the other to store the address of the second last node.
After traversing the list, make the following required link changes
Delete Nodes On Regular Intervals
Add One To Linked List
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Implement Queue Using Linked List
Doubly to Singly Linked List Conversion