Given a Circular Linked List of size N. The task is to delete the given node (excluding the first and last node) in circular linked list and then print the reverse of the circular linked list.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the circular linked list. The next line contains n space separated integers forming the circular linked list. The last line contains the node to be deleted in between the circular linked list.
Print the reverse of the circular linked list with the deleted node.
1 <= T <= 100
1 <= n <= 100
1 <= data <= 100
2 5 7 8 10
1 7 8 10
10 7 5 2
10 7 1
Testcase 1: After deleting 8 from the given circular linked list, it has elements as 2, 5, 7, 10. Now, reversing this list will result in 10, 7, 5, 2.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes