/** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } */ public class Solution { public void DeleteNode(ListNode node) { node.val = node.next.val; node.next = node.next.next; } }
https://leetcode.com/problems/delete-node-in-a-linked-list/#/description