博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
237. Delete Node in a Linked List
阅读量:4623 次
发布时间:2019-06-09

本文共 577 字,大约阅读时间需要 1 分钟。

237. Delete Node in a Linked List

 
 
Total Accepted: 74501 Total Submissions: 170753 Difficulty: Easy

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.

to see which companies asked this question

 

Code:

void deleteNode(struct ListNode* node) {

    struct ListNode* next = node->next;
    *node = *next;
    free(next);
}

转载于:https://www.cnblogs.com/Alex0111/p/5373757.html

你可能感兴趣的文章
update join
查看>>
复杂链表的复制
查看>>
利用docker-machine安装swarm
查看>>
javascript字符类型操作函数
查看>>
thinkphp批量删除的实现
查看>>
请求SpringBoot 服务接口时的中文乱码问题
查看>>
忆少年(七绝)
查看>>
马克思主义与改革(专著)
查看>>
centos7安装hadoop2.6.1,详细教程
查看>>
sql语句select group by order by where一般先后顺序
查看>>
网络1
查看>>
关于jQuery方法解析(一)append-参数设置问题
查看>>
html position display
查看>>
前端学习路线
查看>>
云计算1
查看>>
MVC项目经验杂谈
查看>>
wc命令
查看>>
CentOS下安装mysql及配置使用
查看>>
gevent拾遗
查看>>
Metro学习笔记+心得+体会(四)
查看>>