new paste || ipv4:js fail, n/a or broken? | ipv6:js fail, n/a or broken? ||

paste 35884/8868 | 6 views since 2026-11-05 07:15:06 | text/plain | wrap || empty reply | copy reply | quote reply
js:(
# Delete Node in a Linked List (LeetCode 237): Interview Notes

## Problem
You are given only the node to delete (not the head). The node is not the tail. Remove it from the list in-place.

## Approach
Copy `node.next.val` into `node.val`, then bypass the next node: `node.next = node.next.next`. You cannot free the given node without its predecessor, so overwrite instead.

## Complexity
Time O(1), space O(1).

## Practice tip
Explain why this trick fails for the tail, then practice follow-ups with a [job interview AI assistant](https://www.linkjob.ai/).

*Disclosure: I work on Linkjob AI.*