版权声明:原创勿转 https://cloud.tencent.com/developer/article/1412924
思路
直接把node的next指向next的next
code
代码语言:javascript复制func deleteNode(node *ListNode) {
if node == nil {
return
}
if node.Next == nil {
node = nil
}
node.Val = node.Next.Val
node.Next = node.Next.Next
}