Easy · Linked Lists
Delete node
Given only a reference to a node of a singly linked list that is not the tail (in the samples, the node at 0-based index target), delete it in place without access to the head; afterwards the list must read as before with exactly that node's value removed.
Examples
Example 1
[4,5,1,9] delete idx 1Output: [4,1,9]
Example 2
[1,2,3,4] delete idx 0Output: [2,3,4]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.