当前位置:网站首页>LeetCode 剑指 Offer 18. 删除链表的节点
LeetCode 剑指 Offer 18. 删除链表的节点
2022-04-22 04:38:00 【暮雨林钟】
具体思想:
给定单向链表的头指针和一个要删除的节点的值,定义一个函数删除该节点。
返回删除后的链表的头节点。
没什么可说的,直接删除就行;
具体代码:
class Solution {
public:
ListNode* deleteNode(ListNode* head, int val) {
if(!head) return NULL;
if(head->val == val) return head->next;
head->next = deleteNode(head->next,val);
return head;
}
};
版权声明
本文为[暮雨林钟]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_66776925/article/details/124334528
边栏推荐
- Reenter leetcode (392. Judgment subsequence)
- Keras深度学习实战(2)——使用Keras构建神经网络
- Summary of knowledge points of objects and classes
- 同行面试分享 联想 winform方向 20220420
- 仿真生成随机数计算生成每个同学生日
- QT used in vs 2019
- Chapter 8 of C language programming (fifth edition of Tan Haoqiang) is good at using pointer exercises to analyze and answer
- 树莓派4B编译paddlelite(详细步骤2022年)
- Cilcate environment construction
- SCI论文写作--IEEE期刊的Word模板(LaTeX也有)
猜你喜欢

Android Studio中如何使用在SD卡上面的sqlite数据库文件

权威机构统计:2021 年最佳数据中心网络公司,中国华为和H3C上榜

Matlab曲线的颜色、线型等参数设置方法
![[twelfth database operation - stored procedure]](/img/8f/5ca161db5ffb465dddb9d423418fad.png)
[twelfth database operation - stored procedure]

Jupiter notebook modifying the default opening path
![Crypto JS encryption algorithm library [installation tutorial, cache encryption]](/img/01/1a13a4b75d5fa69533bbe794d7b672.png)
Crypto JS encryption algorithm library [installation tutorial, cache encryption]

Solve the problem that the neo4j browser displays blank circles or non target attributes after importing nodes

How did Jian Daoyun, who started a business in a small team of 10 people and now has an income of more than 100 million without financing, do it?

5_ Data analysis - Data Visualization

Keras深度学习实战(2)——使用Keras构建神经网络
随机推荐
想转行学测试,我劝你先了解一下这些内容
Thesis reading (47): dtfd-mil: double tier feature interpretation multiple instance learning for histopathology
2022T电梯修理考试练习题及在线模拟考试
DHCP protocol workflow
解决IDEA中文乱码问题(配置文件乱码)
2022山东省安全员C证特种作业证考试题库及答案
matlab如何实现不同的值显示不同的颜色
spark 安装与使用 educoder
jsp hello world中文乱码
链表第三篇
12.libevent循环函数和退出测试
Chapter 8 of C language programming (fifth edition of Tan Haoqiang) is good at using pointer exercises to analyze and answer
At32 MCU audio 24bit routine
爬演员名字加链接
Objectmapper, stop being new like a second product
2022年A特种设备相关管理(电梯)复训题库及答案
STL的unique函数返回值
Paper reading (49): big data security and privacy protection (Kopp)
2022G2电站锅炉司炉操作证考试题库及在线模拟考试
L1-053 electronic (10 points)