Skip to content

Commit a29f176

Browse files
author
whd
committed
upload
1 parent ba95d2b commit a29f176

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Definition for singly-linked list.
3+
* struct ListNode {
4+
* int val;
5+
* ListNode *next;
6+
* ListNode(int x) : val(x), next(NULL) {}
7+
* };
8+
*/
9+
class Solution {
10+
public:
11+
void deleteNode(ListNode* node) {
12+
node->val = node->next->val;
13+
ListNode *next = node->next;
14+
node->next = next->next;
15+
delete next;
16+
}
17+
};

0 commit comments

Comments
 (0)