首页 > 其他 > 详细

Leetcode 237 Delete Node in a Linked List

时间:2016-01-15 14:20:14      阅读:240      评论:0      收藏:0      [点我收藏+]

如题 删除是要注意让现在的链表等于下一个链表的值

1 class Solution {
2 public:
3     void deleteNode(ListNode* node) {
4         ListNode *nextnode = node ->next;
5         *node = *nextnode;
6         node->next = nextnode ->next;
7         delete nextnode;
8     }
9 };

 

Leetcode 237 Delete Node in a Linked List

原文:http://www.cnblogs.com/onlyac/p/5132975.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!