Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4after calling your function.

package cn.magicdu;

import cn.magicdu.extra.ListNode;

public class _237_Delete_Node_in_a_Linked_List {
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
}

每天一道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 to th ...

  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 to th ...

  3. [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 to th ...

  4. (easy)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 to th ...

  5. leetcode 237 Delete Node in a Linked List python

    题目: Write a function to delete a node (except the tail) in a singly linked list, given only access t ...

  6. 17.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 to th ...

  7. [Leetcode]237. Delete Node in a Linked List -David_Lin

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

  8. LeetCode 237. Delete Node in a Linked List 删除链表结点(只给定要删除的结点) C++/Java

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

  9. [LeetCode] 237. Delete Node in a Linked List_Easy tag: Linked List

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

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

随机推荐

  1. Linux实战教学笔记08:Linux 文件的属性(下半部分)

    第八节 Linux 文件的属性(下半部分) 标签(空格分隔): Linux教学笔记 ---更多相关资料请点我查看 第1章 链接的概念 在linux系统中,链接可分为两种:一种为硬链接(Hard Lin ...

  2. 山东理工大学ACM平台题答案关于C语言 1137 C/C++经典程序训练7---求某个范围内的所有素数

    C/C++经典程序训练7---求某个范围内的所有素数 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 求小于n的所有素数,按照每行 ...

  3. DbHelper数据操作类

    摘要:本文介绍一下DbHelper数据操作类 微软的企业库中有一个非常不错的数据操作类.但是,不少公司(起码我遇到的几个...),对一些"封装"了些什么的东西不太敢用,虽然我推荐过 ...

  4. Bootstrap排版

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...

  5. C#fixed关键字

    fixed 语句禁止垃圾回收器重定位可移动的变量. fixed 语句只在 不安全的上下文中是允许的. Fixed 还可用于创建 固定大小缓冲区. fixed 语句设置指向托管变量的指针,并在执行该语句 ...

  6. BW性能优化

    少写例程,减少ABAP处理时间,例程要有效率减少查询数据库表先加载主数据,然后加载事务数据创建聚集进行数据压缩M:N关系的数据不能放到一个维度减少计算指标数量,提高上载效率并行加载建模型时如果有日的分 ...

  7. 用DirectShow实现视频採集-流程构建

    DirectShow作为DirectX的一个子集,它为用户提供了强大.方便的多媒体开接口,而且它拥有直接操作硬件的能力,这使得它的效率远胜于用GDI等图形方式编写的多媒体程序.前面一篇文章已经对Dir ...

  8. gcc中不同namespace中同名class冲突时

    正常情况下,编译器都会报错,提示你有两个候选类,让你明确的选择一个. 比如我的情况,我自己设计了一个类Message, 然后在某个文件里面引用了它.但是我的文件中又引入了mongodb的头文件,非常不 ...

  9. Github上最全的APICloud开源前端框架效果盘点(转)

    1.微信网站几分钟变身“原生 App” 微信推出了微信JS-SDK,使微信公共号可以直接调用微信原生的接口,具备部分原生应用的能力.微信JS-SDK的推出,将大大提高微信公共号的 用户体验,但是如果存 ...

  10. Javascript-显示系统时间

    /*JS-显示系统时间*/function showLocale(objD) {    var str, colorhead, colorfoot;    var yy = objD.getYear( ...