当前位置:网站首页>剑指offer:在O(1)时间删除链表结点
剑指offer:在O(1)时间删除链表结点
2022-08-02 14:11:00 【超级码力奥】
原题链接:https://www.acwing.com/problem/content/85/
简直不要太庙。借尸还魂了属于是。
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */
class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* p = node->next->next;
node->val = node->next->val;
node->next = p;
}
};
边栏推荐
- Introduction to MATLAB drawing functions ezplot explanation
- jest test, component test
- pygame图像连续旋转
- Win10 computer can't read U disk?Don't recognize U disk how to solve?
- KiCad Common Shortcuts
- casbin模型
- MATLAB绘图函数ezplot入门详解
- word方框怎么打勾?
- Failed to install using npx -p @storybook/cli sb init, build a dedicated storybook by hand
- Ubuntu通过apt安装Mysql
猜你喜欢
3. User upload avatar
Mysql connection error solution
STM32LL library - USART interrupt to receive variable length information
Use tencent cloud builds a personal blog
Win11 system cannot find dll file how to fix
MATLAB图形加标注的基本方法入门简介
第三十章:普通树的存储和遍历
What should I do if Windows 10 cannot connect to the printer?Solutions for not using the printer
Installation and configuration of Spark and related ecological components - quick recall
基于最小二乘法的线性回归分析方程中系数的估计
随机推荐
【离散化+前缀和】Acwing802. 区间和
Mapreduce环境详细搭建和案例实现
第二十八章:解题技巧
基于最小二乘法的线性回归分析方程中系数的估计
Based on the least squares linear regression equation coefficient estimation
SQL的通用语法和使用说明(图文)
5. Transaction management
yolov5官方代码解读——前向传播
3. User upload avatar
Win11 keeps popping up User Account Control how to fix it
STM32LL库——USART中断接收不定长信息
倍增和稀疏表
win10 system update error code 0x80244022 how to do
永久更改pip源
4.发布帖子,评论帖子
In-depth understanding of Golang's Map
使用libcurl将Opencv Mat的图像上传到文件服务器,基于post请求和ftp协议两种方法
第三十三章:图的基本概念与性质
jest test, component test
Summarize computer network super comprehensive test questions