Xiaohe-LeetCode 237 Delete Node in a Linked List
This is almost the best solution.16ms.
/**
* 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) {
if(node && node->next){
node->val = node->next->val;
node->next = node->next->next;
}
}
};
转载于:https://www.cnblogs.com/CathyXiaohe/p/4985407.html
Xiaohe-LeetCode 237 Delete Node in a Linked List相关推荐
- leetcode 237: Delete Node in a Linked List
题目: Write a function to delete a node (except the tail) in a singly linked list, given only access t ...
- LeetCode 237. Delete Node in a Linked List
题目: Write a function to delete a node (except the tail) in a singly linked list, given only access t ...
- LeetCode刷题记录3——237. Delete Node in a Linked List(easy)
LeetCode刷题记录3--237. Delete Node in a Linked List(easy) 目录 LeetCode刷题记录3--237. Delete Node in a Linke ...
- 237. Delete Node in a Linked List
题目: Write a function to delete a node (except the tail) in a singly linked list, given only access t ...
- Leet Code OJ 237. Delete Node in a Linked List [Difficulty: Easy]
题目: Write a function to delete a node (except the tail) in a singly linked list, given only access t ...
- C#LeetCode刷题之#237-删除链表中的节点(Delete Node in a Linked List)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3832 访问. 请编写一个函数,使其可以删除某个链表中给定的(非末 ...
- LeetCode 450 Delete Node in a BST(二叉搜索树中的删除结点)
问题:给出一个二叉搜索树,删除指定的结点,要求返回删除后的树. 算法思路: 1.删除的结点是叶子结点,则直接删除 2.删除的结点只有一个子结点(左孩子右孩子),则直接用子结点替换 3.删除的结点左右孩 ...
- java中删除node节点_[Java]LeetCode237. 删除链表中的节点 | Delete Node in a Linked List
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ ➤微信公众号:山青咏芝(shanqingyongzhi) ➤博客园地址:山青咏芝(https://www.cnblog ...
- Jan 12 - Delete Node in a Linked List; Data Structure; Linked List; Pointer;
代码: /*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* List ...
最新文章
- 互联网人不敢生孩子:加班多、想跳槽、怕被边缘化
- 28条有关人工智能的名言,靠不靠谱你来看!
- 【PAT】1009. Product of Polynomials (25)
- UIColor之【扩展:#FFFFFF -UIColor】
- python图片保存为txt文件_python + opencv实现提取png图像的像素信息并存储到txt文件中(附安装指导)...
- LeetCode 1706. 球会落何处(模拟)
- 分享一个狂雨小说采集规则 - 顶点小说采集
- 云计算和大数据时代网络技术揭秘
- 迅为RK3399开发板嵌入式linux开发指南
- css宋体代码_css中宋体怎么设置?
- keras之分类问题和回归问题
- win10 网络发现 打开保存后,自动关闭
- oracle 加权久期,债券 加权久期 怎么计算
- 基本求导法则与导数公式
- Mac新手扫盲教程:苹果Mac电脑使用小技巧
- 3d可视化建模产品三维展示平台应用广
- intel英特尔架构
- oswatch的安装和使用(转)
- html与word字体大小转换,字体大小不一样,当html转换为Word使用Microsoft.Office.Interop.Word...
- 编程菜鸟到大鸟--代码积累