当前位置:网站首页>LeetCode 237. Delete a node in a linked list
LeetCode 237. Delete a node in a linked list
2022-08-10 12:00:00 【Mizuna pen】
Original URL: https://leetcode.cn/problems/delete-node-in-a-linked-list/
There is a linked list, delete a given node, and cannot directly access the head node; ensure that the deletion is not the last node;
// node is the node to delete// Since it is guaranteed that it is not the last node to be deleted, you can exchange values with the next node to be deleted, and then delete the latter onepublic void deleteNode(ListNode node) {if(node == null || node.next == null) {return;}ListNode next = node.next;int tmp = node.val;node.val = next.val;next.val = tmp;node.next = next.next;}边栏推荐
- OPNsense安装配置Zenarmor
- SMIC CIM localization project suspended?Rising software: not shut down, changed to remote development!
- Redis常用命令
- 暑期总结4
- Ssm framework construction process [easy to understand]
- 软件架构简介
- 可视化服务编排在金融APP中的实践
- AutoCAD Map 3D功能之一暴力处理悬挂点(延伸)
- 网络套接字(UDP和TCP编程)
- Pulling drills - 56 Finding the right interval
猜你喜欢

dedecms支持Word内容一键导入

CLIP还能做分割任务?哥廷根大学提出一个使用文本和图像prompt,能同时作三个分割任务的模型CLIPSeg,榨干CLIP能力...

WeChat applet, global variables change in one place and the state in other places also changes.

Where can I view the version record of WeChat applet submission review history?

7、Instant-ngp

APP automation testing practice based on UiAutomator2+PageObject mode

ViT结构详解(附pytorch代码)

单目操作符(含原码反码补码转换)

LeetCode50天刷题计划(Day 19—— 在排序数组中查找元素的第一个和最后一个位置(9.10-10.40)
![[E-commerce operation] Do you really understand social media marketing (SMM)?](/img/5b/6682c613305deb3dc15401077d38a0.png)
[E-commerce operation] Do you really understand social media marketing (SMM)?
随机推荐
LeetCode 21. Merge two ordered linked lists
LeetCode 82. 删除排序链表中的重复元素 II
力扣练习——62 有效的数独
LeetCode 82. Remove Duplicate Elements in Sorted List II
How many constants and data types do you remember?
模块九 - 设计电商秒杀系统
搜索--09
石墨文档打开文档时快速定位到上次写的位置
StoneDB Document Bug Hunting Season 1
HDU 4135: Co-prime (the principle of inclusion and exclusion)
[E-commerce operation] Do you really understand social media marketing (SMM)?
codevs 2370 小机房的树 (LCA)
Module 9 - Designing an e-commerce seckill system
mpf6_Time Series Data_quandl_更正kernel PCA_AIC_BIC_trend_log_return_seasonal_decompose_sARIMAx_ADFull
网络基础(第一节)
Centos7环境使用Mysql离线安装包安装Mysql5.7
VSCode remote connection server error: Could not establish connection to "xxxxxx" possible error reasons and solutions
不止跑路,拯救误操作rm -rf /*的小伙儿
Buckle Exercise - 61 Sort by frequency of characters
OPNsense安装配置Zenarmor