标签:init ext list str efi mis let ons class
/** * 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 * lastNode = node; while (node->next != NULL) { node->val = node->next->val; lastNode = node; node = node->next; } lastNode->next = NULL; delete node; } };
Your runtime beats 100.00 % of cpp submissions.
【Leetcode】237. Delete Node in a Linked List
标签:init ext list str efi mis let ons class
原文地址:https://www.cnblogs.com/AndrewGhost/p/9281146.html