标签:改变 pre one pen width des mamicode 实现 lap
要求
思路
实现
1 struct ListNode { 2 int val; 3 ListNode *next; 4 ListNode(int x) : val(x), next(NULL) {} 5 }; 6 7 class Solution { 8 public: 9 void deleteNode(ListNode* node) { 10 11 if( node == NULL ) 12 return; 13 14 if( node->next == NULL){ 15 delete node; 16 node = NULL; 17 return; 18 } 19 20 node->val = node->next->val; 21 ListNode* delNode = node->next; 22 node->next = delNode->next; 23 24 delete delNode; 25 26 return; 27 } 28 };
[刷题] LeetCode 237 Delete Nodes in a Linked List
标签:改变 pre one pen width des mamicode 实现 lap
原文地址:https://www.cnblogs.com/cxc1357/p/12640500.html