237. Delete Node in a Linked List
原题链接:https://leetcode.com/problems/delete-node-in-a-linked-list/description/
实现如下:
/**
* Created by clearbug on 2018/2/26.
*/
public class Solution {
public static void main(String[] args) {
Solution s = new Solution();
}
/**
* 这他么是一道神奇的题目,我看了三遍完全没看懂,无奈之下,去看了下面👇参考中提到的博客,才恍然大悟!
*
* @param node
*/
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
}