237. 删除链表中的节点
题目
代码
/**
* 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) {
auto next=node->next;
*node = *(node->next);
delete next;
}
};
https://github.com/li-zheng-hao