0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 15:36:27 +00:00
OI-codes/AcWing/28/28.cpp

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;
}
};