Java Collections | Set 7 (LinkedList)
Submissions: 311   Accuracy:

63.99%

  Difficulty: Easy   Marks: 2

Given only a pointer to a node to be deleted in a singly linked list. Print the whole Linked List after deletion.

Input:
The first line of input contains an element T, denoting the no of test cases. Then T test cases follow. Each test case contains two lines. The first line of each test case contains two integers N denoting the no of elements of the linked list and P denoting the number of the node which is to be deleted (starting from 0) . Then in the next line are N space separated values of the linked list.

Output:
The output for each test case will be the space separated elements of the updated linked list.

Constraints:
1<=T<=100
2<=N<=103
0<=P<(N-1)
Example(To be used only for expected output):

Input:
2
5 2
1 2 3 4 5
4 0
1 3 6 9

Output:
1 2 4 5
3 6 9

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: S_A
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.