leetcode icon indicating copy to clipboard operation
leetcode copied to clipboard

237_Delete Node in a Linked List

Open KnightJoker opened this issue 8 years ago • 2 comments

请问一下如果这个节点正好是尾节点的时候该怎么处理啊?

KnightJoker avatar Oct 12 '16 01:10 KnightJoker

if (!node || !node->next) { return; } node->val = node->next->val; node->next = node->next->next;

这是我的代码,在尾节点的时候,并没有做到删除效果啊- -+

KnightJoker avatar Oct 12 '16 01:10 KnightJoker

The solution does not deal with memory. The removed node is not deleted in this solution.

ar27 avatar Dec 18 '19 01:12 ar27