TreeviewCopyright © aleen42 all right reserved, powered by aleen42
03. 删除中间节点
https://leetcode-cn.com/problems/delete-middle-node-lcci/
Java
class Solution {
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
}
Python
'''
@Author: Goog Tech
@Date: 2020-07-19 22:29:49
@Description: https://leetcode-cn.com/problems/delete-middle-node-lcci/
@FilePath: \leetcode-googtech\面试题02\#03. 删除中间节点\Solution.py
'''
class Solution(object):
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
"""
node.val = node.next.val
node.next = node.next.next