Skip to content

Commit e9a2b9a

Browse files
committed
Time: 123 ms, Memory: 36.9 MB - LeetHub
1 parent eddb0b0 commit e9a2b9a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Definition for singly-linked list.
3+
* public class ListNode {
4+
* public int val;
5+
* public ListNode next;
6+
* public ListNode(int x) { val = x; }
7+
* }
8+
*/
9+
public class Solution {
10+
public void DeleteNode(ListNode node)
11+
{
12+
node.val = node.next.val;
13+
while (node.next.next != null)
14+
{
15+
node = node.next;
16+
node.val = node.next.val;
17+
}
18+
19+
node.next = null;
20+
}
21+
}

0 commit comments

Comments
 (0)