Skip to content

Commit 08c0a4a

Browse files
committed
add ans for delete node
1 parent 57a8c24 commit 08c0a4a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Definition for singly-linked list.
2+
# class ListNode:
3+
# def __init__(self, x):
4+
# self.val = x
5+
# self.next = None
6+
7+
class Solution:
8+
def deleteNode(self, node):
9+
"""
10+
:type node: ListNode
11+
:rtype: void Do not return anything, modify node in-place instead.
12+
"""
13+
node.val = node.next.val
14+
node.next = node.next.next

0 commit comments

Comments
 (0)