Given a doubly linked list and a position. The task is to delete a node from given position in a doubly linked list.
Input:
First line of input contains number of testcases. First line of each testcase contains number of elements in the linked list and next line contains the elements of the linked list. The last line contains the position from which element is to be deleted.
Output:
Delete the node from the given doubly linked list and set *head_ref if required.
User Task:
The task is to complete the function deleteNode() which should delete the node at given position.
Constraints:
1 <= T <= 300
2 <= N <= 100
1 <= x <= N
Example:
Input:
2
3
1 3 4
3
4
1 5 2 9
1
Output:
1 3
5 2 9
Explanation:
Testcase 1: After deleting the node at position 3 (position starts from 1), the linked list will be now as 1->3.
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.
preparecodinginterview_dot_com | 190 |
__murugan__ | 173 |
manvimahajan20 | 140 |
xiaoyan_yunche | 139 |
ShameekAgarwal | 116 |
preparecodinginterview_dot_com | 190 |
__murugan__ | 173 |
manvimahajan20 | 166 |
SoumyaKaushik | 146 |
arpit_anshuman | 140 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |