-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path237.cpp
More file actions
26 lines (25 loc) · 677 Bytes
/
Copy path237.cpp
File metadata and controls
26 lines (25 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*******************************************************************************
> File Name: 237.cpp
> Author: sillyplus
> Mail: oi_boy@sina.cn
> Created Time: Fri Mar 25 02:30:56 2016
*******************************************************************************/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
if (node != NULL) {
ListNode* tmp = node->next;
node->val = tmp->val;
node->next = tmp->next;
delete tmp;
}
}
};