237. Delete Node in a Linked List
Intuition
Since we don't have access to the head of the list, and we’re told the node to be deleted is not the last one, the only way to "delete" the node is to copy the value from the next node into the current node, and then skip the next node.
Effectively, we're replacing the current node with the next node and removing the next node instead.
Complexity
Space Complexity
Time Complexity
Code
Last updated