# LeetCode237:Delete Node in a Linked List

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.

/**
* public class ListNode {
*     int val;
*     ListNode next;
*     ListNode(int x) { val = x; }
* }
*/
public class Solution {
public void deleteNode(ListNode node) {
if(node==null)
return;
if(node.next==null)
node=null;
node.val=node.next.val;
node.next=node.next.next;
}
}

#### LeetCode 237 : Delete Node in a Linked List

2015-07-27 13:54:09

#### leetcode 237: Delete Node in a Linked List

2015-07-15 14:50:40

#### LeetCode-237:Delete Node in a Linked List (Python)

2016-04-09 23:29:06

#### 237. Delete Node in a Linked List [easy] (Python)

2016-05-13 21:18:06

#### Leetcode_237_Delete Node in a Linked List

2015-08-07 09:53:09

#### [leetcode-237]Delete Node in a Linked List(C语言)

2015-07-17 10:55:15

#### 237. Delete Node in a Linked List（python）

2016-09-18 21:47:47

#### 【简单】Lintcode 372:Delete Node in a Linked List

2018-05-18 22:33:28

#### leetcode笔记--Delete Node in a Linked List

2016-02-19 14:36:22

#### LeetCode 237 -Delete Node in a Linked List ( JAVA )

2016-04-06 16:22:58