0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 07:31:58 +00:00
OI-codes/AcWing/28/28.cpp

18 lines
365 B
C++
Raw Normal View History

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