TABLE OF CONTENT


delete-node-in-a-linked-list

jiuzhang

class Solution:
    """
    @param: node: the node in the list should be deleted
    @return: nothing
    """
    def deleteNode(self, node):
        # write your code here
        if not node or not node.next:
            node = None
            return

        node.val = node.next.val
        node.next = node.next.next


blog comments powered by Disqus

Published

30 December 2019

Tags