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. VC中监测程序运行时间(二)-毫秒级

    /* * 微秒级计时器,用来统计程序运行时间 * http://blog.csdn.net/hoya5121/article/details/3778487#comments * //整理 [10/1 ...

  2. mac ide

    常用IDE xcode sublime text eclipse xampp + phpstorm sql客户端:sequel pro 虚拟机:parallels desktop sftp客户端:Cy ...

  3. cocos2d-x Mask的实现及优化

    转自:http://blog.ch-wind.com/cocos2d-x%E4%B8%ADmask%E7%9A%84%E5%AE%9E%E7%8E%B0%E5%8F%8A%E4%BC%98%E5%8C ...

  4. main方法执行之前,做什么事

    1.我们知道程序的入口是main方法,那么在执行main方法之前,需要做些什么准备工作呢? 2.main方法执行之前,必须要把non-local static对象构造完成.static对象有:全局对象 ...

  5. 【转】C++ static关键字

    原文:http://blog.csdn.net/hackbuteer1/article/details/7487694 C++的static有两种用法:面向过程程序设计中的static和面向对象程序设 ...

  6. cdoj 1253 阿里巴巴和n个大盗 博弈论

    阿里巴巴和n个大盗 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/1253 D ...

  7. Codeforces Round #Pi (Div. 2) E. President and Roads tarjan+最短路

    E. President and RoadsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567 ...

  8. C#窗体间通讯的几种处理方法

    应用程序开发中,经常需要多窗体之间进行数据通信,写几个例子,把几种常用的通信方式总结一下: 主窗体Form1是一个ListBox,单击选中某列时,弹出窗体Form2,Form2中两个控件,一个是Tex ...

  9. VVDocumenter - Xcod代码注释工具

    刚接触IOS开发时,发现XCODE非常的强大的,后续的代码实践中发现XOCDE的代码文档注释非常的差, 每次都要用手敲,蛋疼至极: 随着不断学习发现XCODE有代码片段内嵌一说(如:for .bloc ...

  10. 在 Fedora 里安装自带的 MATE和 cinnamon

    参见  http://wiki.mate-desktop.org/download#fedora安装方法: yum groupinstall mate-desktop yum groupinstall ...