0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 21:58:48 +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;
}
};