This question has been asked multiple times in interviews of companies like Amazon and Goldman Sachs.
Problem Statement:
Delete a node from a linked list but you are given only the pointer to the node which is to be deleted.
Link to problem: https://leetcode.com/problems/delete-...
Approach:
Recursively copy the data from the next node to the current node while traversing the complete linked list.
PS: The code does not work when node to be deleted is the last node(tail). Comment the modification in the code such that it works for the case when the node to be deleted is the last node.
About:
Best YouTube Channel For Interview Preparation.
Subscribe Now.
Problem Link: https://leetcode.com/problems/delete-...
Music: https://www.bensound.com
On this page of the site you can watch the video online Delete Node In A Linked List Without Head Pointer | Interview Preparation | Programming Playground with a duration of hours minute second in good quality, which was uploaded by the user Programming Playground 16 August 2020, share the link with friends and acquaintances, this video has already been watched 61 times on youtube and it was liked by 3 viewers. Enjoy your viewing!