下一个值覆盖当前值即可。。
class Solution {
public void deleteNode(ListNode node) {
while (node.next.next != null) {
node.val = node.next.val;
node = node.next;
}
node.val = node.next.val;
node.next = null;
}
}
标签:node,null,val,next,链表,deleteNode,237,LeetCode
来源: https://www.cnblogs.com/acbingo/p/14885022.html