1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * struct ListNode *next; 6 * }; 7 */ 8 9 /*思路:把要删除节点的值和下一个节点的值相同,然后释放下一个节点*/ 10 void deleteNode(struct ListNode* node) { 11 struct ListNode *p = node->next; 12 node->val = p->val; 13 node->next=p->next; 14 free(p); 15 }