当前位置:网站首页>【Pointing to Offer】Pointing to Offer 18. Delete the node of the linked list
【Pointing to Offer】Pointing to Offer 18. Delete the node of the linked list
2022-07-30 18:23:00 【@ have a cup of coffee】
算法汇总
以下是所有算法汇总,包括GitHub源码地址链接:力扣算法练习汇总(持续更新…)
题目
关键点
1、
2、
代码
1.解体方法
思路
代码
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */
class Solution {
public ListNode deleteNode(ListNode head, int val) {
if (head == null) {
return null;
}
ListNode node = new ListNode(-1);
node.next = head;
ListNode temp = node;
while (temp.next != null) {
if (temp.next.val == val) {
temp.next = temp.next.next;
break;
}
temp = temp.next;
}
return node.next;
}
}
时间和空间复杂度
2.解题方法,如暴力法
思路
代码
时间和空间复杂度
边栏推荐
- Mysql执行原理剖析
- 【HMS Core】【FAQ】运动健康、音频编辑、华为帐号服务 典型问题合集7
- LeetCode Exercise - Two Questions About Finding Sum of Array Elements
- CCNA-网络汇总 超网(CIDR) 路由最长掩码匹配
- 第4章 控制执行流程
- 【HMS core】【ML Kit】机器学习服务常见问题FAQ(二)
- MYSQL(基本篇)——一篇文章带你走进MYSQL的奇妙世界
- 积性函数
- 二分答案裸题(加一点鸽巢原理)
- Informatics Olympiad 1915: [01NOIP Popularization Group] Greatest Common Divisor and Least Common Multiple | Luogu P1029 [NOIP2001 Popularization Group] The problem of the greatest common divisor and
猜你喜欢
Pagoda builds PHP adaptive lazy website navigation source code measurement
开源盛宴ApacheCon Asia 2022即将开幕,精彩不容错过!
One year after graduation, I was engaged in software testing and won 11.5k. I didn't lose face to the post-98 generation...
【AGC】构建服务1-云函数示例
Application of time series database in the field of ship risk management
LeetCode 练习——关于查找数组元素之和的两道题
SQL行列转换
千亿级、大规模:腾讯超大 Apache Pulsar 集群性能调优实践
固定资产可视化智能管理系统
scrapy基本使用
随机推荐
千亿级、大规模:腾讯超大 Apache Pulsar 集群性能调优实践
CMake library search function does not search LD_LIBRARY_PATH
【AGC】构建服务1-云函数示例
运营 23 年,昔日“国内第一大电商网站”黄了...
积性函数
MYSQL(基本篇)——一篇文章带你走进MYSQL的奇妙世界
MYSQL (Basic) - An article takes you into the wonderful world of MYSQL
图解LeetCode——11. 盛最多水的容器(难度:中等)
Mysql执行原理剖析
The sixteenth issue of eight-part article Balabala said (MQ)
Codeblocks + Widgets 创建窗口代码分析
【开发者必看】【push kit】推送服务典型问题合集3
ESP8266-Arduino编程实例-BMP180气压温度传感器驱动
博纳影通过IPO注册:阿里腾讯是股东 受疫情冲击明显
MySQL——基础知识
【HarmonyOS】【ARK UI】HarmonyOS ets语言怎么实现双击返回键退出
Web结题报告
What are the applications of X-rays?
好未来单季营收2.24亿美元:同比降84% 张邦鑫持股26.3%
Fixed asset visualization intelligent management system