Delete Node in a Linked List Problem

Delete Node in a Linked List Problem — ExecCode Easy DSA Practice

Solve the Delete Node in a Linked List problem on ExecCode. Free online easy DSA practice in Linked List. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the node to be deleted node. Your task is to there is a singly-linked list head and we want to delete a node node in it. You will not be given access to the first node of head. All the values of the linked list are unique, and it is guaranteed that the given node node is not the last node in the linked list. Delete the given node. Return the required answer exactly as shown in the examples.

Examples

Input {"nums": [4, 5, 1, 9], "val": 5}; Output [4, 1, 9]

Constraints

The number of the nodes in the given list is in the range [2, 1000]. -1000 <= Node.val <= 1000 The value of each node in the list is unique. The node to be deleted is in the list and is not a tail node.

Practice Delete Node in a Linked List free on ExecCode. Browse DSA problems, topic map, and placement guides.