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


  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.

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.

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

Example(To be used only for expected output):

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

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, generate link and share the link here.

to report an issue on this page.