To delete the node after a given node prev: ```pseudocode
prev.next = prev.next.next
But what if you need to delete a node and you only have a reference to that node itself, not its predecessor? You can't easily find the predecessor in a singly linked list.
The trick: copy the next node's value into the current node, then delete the next node. ```pseudocode
node.val = node.next.val
node.next = node.next.next
``` This doesn't work for the last node since there's no next node to copy from. Time: $O(n)$. Space: $O(1)$.