难度:容易
1. Description
372. Delete Node in a Linked List2. Solution
- python
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param: node: the node in the list should be deletedt
@return: nothing
"""
def deleteNode(self, node):
# write your code here
node.val = node.next.val
node.next = node.next.next
网友评论