We can't really delete the node, but we can kinda achieve the same effect by instead removing the **next** node after copying its data into the node that we were asked to delete.

**C++**

```
void deleteNode(ListNode* node) {
*node = *node->next;
}
```

But better properly delete the next node:

```
void deleteNode(ListNode* node) {
auto next = node->next;
*node = *next;
delete next;
}
```

**Java and C#**

```
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
```

**Python**

```
def deleteNode(self, node):
node.val = node.next.val
node.next = node.next.next
```

**C**

```
void deleteNode(struct ListNode* node) {
*node = *node->next;
}
```

But better properly free the next node's memory:

```
void deleteNode(struct ListNode* node) {
struct ListNode* next = node->next;
*node = *next;
free(next);
}
```

**JavaScript**

```
var deleteNode = function(node) {
node.val = node.next.val;
node.next = node.next.next;
};
```

**Ruby**

```
def delete_node(node)
node.val = node.next.val
node.next = node.next.next
nil
end
```