问题:
、
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { public void deleteNode(ListNode node) { //给出的节点就是要删除的(也就是删除当前的node节点) node.val = node.next.val; node.next = node.next.next; } }
原文:https://www.cnblogs.com/nxzblogs/p/11275147.html