Java for LeetCode 237 Delete Node in a Linked List

Java实现如下:

public class Solution {
    public void deleteNode(ListNode node) {
        if(node==null||node.next==null)
        	return;
        node.val = node.next.val;  
        node.next = node.next.next;  
        
    }
}

 

posted @ 2016-07-10 22:14  TonyLuis  阅读(240)  评论(0编辑  收藏  举报