237. Delete Node in a Linked List
Solution
-
Copy the next node’s val to next.next node
-
Move the pointer
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