当前位置:网站首页>剑指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;
}
};
边栏推荐
猜你喜欢
Detailed explanation of MATLAB drawing function fplot
Do Windows 10 computers need antivirus software installed?
1. Development community homepage, register
3. User upload avatar
Open the door of power and electricity "Circuit" (2): Power Calculation and Judgment
word方框怎么打勾?
pygame绘制弧线
SQL的通用语法和使用说明(图文)
How to set the win10 taskbar does not merge icons
【离散化+前缀和】Acwing802. 区间和
随机推荐
专硕与学硕
轻量化AlphaPose
Win10 Settings screen out from lack of sleep?Win10 set the method that never sleep
Win7 encounters an error and cannot boot into the desktop normally, how to solve it?
二叉树创建之层次法入门详解
Doubled and sparse tables
What should I do if the Win10 system sets the application identity to automatically prompt for access denied?
LeetCode 2344. 使数组可以被整除的最少删除次数 最大公约数
pygame绘制弧线
第二十八章:解题技巧
Compilation error D8021: Invalid numeric argument '/Wextra' cl command line error d8021 invalid numeric argument '/Wextra'
Exotic curiosity-a solution looking - bit operations
2021-10-14
IPV4和IPV6是什么?
3. User upload avatar
Win10 computer can't read U disk?Don't recognize U disk how to solve?
A clean start Windows 7?How to load only the basic service start Windows 7 system
背包问题-动态规划-理论篇
Mysql之MVCC
Open the door of power and electricity "Circuit" (2): Power Calculation and Judgment