/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
void deleteNode(struct ListNode* node) {
struct ListNode *p = node, *last=NULL;
if(!p) return;
while(p->next) {
p->val = p->next->val;
last = p;
p = p->next;
}
free(last->next);
last->next = NULL;
}
Leetcode-237.删除链表中的节点-C语言
最新推荐文章于 2023-06-15 08:50:23 发布