mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-14 16:18:49 +00:00
18 lines
365 B
C++
18 lines
365 B
C++
/**
|
|
* 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) {
|
|
ListNode* tmp = node->next;
|
|
node->val = node->next->val;
|
|
node->next = node->next->next;
|
|
delete tmp;
|
|
}
|
|
};
|