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相关推荐

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. C#LeetCode刷题之#237-删除链表中的节点(Delete Node in a Linked List)

    问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3832 访问. 请编写一个函数,使其可以删除某个链表中给定的(非末 ...

  7. LeetCode 450 Delete Node in a BST(二叉搜索树中的删除结点)

    问题:给出一个二叉搜索树,删除指定的结点,要求返回删除后的树. 算法思路: 1.删除的结点是叶子结点,则直接删除 2.删除的结点只有一个子结点(左孩子右孩子),则直接用子结点替换 3.删除的结点左右孩 ...

  8. java中删除node节点_[Java]LeetCode237. 删除链表中的节点 | Delete Node in a Linked List

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ ➤微信公众号:山青咏芝(shanqingyongzhi) ➤博客园地址:山青咏芝(https://www.cnblog ...

  9. 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 ...

最新文章

  1. 互联网人不敢生孩子:加班多、想跳槽、怕被边缘化
  2. 28条有关人工智能的名言,靠不靠谱你来看!
  3. 【PAT】1009. Product of Polynomials (25)
  4. UIColor之【扩展:#FFFFFF -UIColor】
  5. python图片保存为txt文件_python + opencv实现提取png图像的像素信息并存储到txt文件中(附安装指导)...
  6. LeetCode 1706. 球会落何处(模拟)
  7. 分享一个狂雨小说采集规则 - 顶点小说采集
  8. 云计算和大数据时代网络技术揭秘
  9. 迅为RK3399开发板嵌入式linux开发指南
  10. css宋体代码_css中宋体怎么设置?
  11. keras之分类问题和回归问题
  12. win10 网络发现 打开保存后,自动关闭
  13. oracle 加权久期,债券 加权久期 怎么计算
  14. 基本求导法则与导数公式
  15. Mac新手扫盲教程:苹果Mac电脑使用小技巧
  16. 3d可视化建模产品三维展示平台应用广
  17. intel英特尔架构
  18. oswatch的安装和使用(转)
  19. html与word字体大小转换,字体大小不一样,当html转换为Word使用Microsoft.Office.Interop.Word...
  20. 编程菜鸟到大鸟--代码积累

热门文章

  1. java 字符串 转double_如何使用Java程序将Double转换为String
  2. 倒车灯E-mark认证的流程是怎样的?
  3. python获取sheet名称_从Python获取活动Excel工作簿的名称
  4. windows xp出现系统乱码应该怎么办?
  5. 分享个变形金刚辅助脚本,自动打活动资源买电池
  6. Lucene源代码之信息索引
  7. 【编译原理】课程实验——基于Java的词法分析与语法分析
  8. 探探php模板下载,C3+H5+jQuery仿探探APP手机滑动切换特效
  9. 字数达到论文查重系统的上限怎么办?
  10. 车架号汽车vin码识别