LeetCode
思路
题解
typescript
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} node
* @return {void} Do not return anything, modify node in-place instead.
*/
var deleteNode = function(node) {
// 将下一个节点val给要删除的节点
node.val = node.next.val
// 改变next指向,变相删除
node.next = node.next.next
};