LeetCode-237 Delete Node in a Linked List Solution (with Java)

1. Description:

Notes:

2. Examples:

3.Solutions:

 1 /**
 2  * Created by sheepcore on 2019-05-07
 3  * Definition for singly-linked list.
 4  * public class ListNode {
 5  *     int val;
 6  *     ListNode next;
 7  *     ListNode(int x) { val = x; }
 8  * }
 9  */
10 class Solution {
11     public void deleteNode(ListNode node) {
12         node.val = node.next.val;
13         node.next = node.next.next;   
14     }
15 }
posted @ 2020-03-02 13:29  SheepCore  阅读(83)  评论(0编辑  收藏  举报