Skip to content

Commit 792bfb3

Browse files
committed
Update solution 203 [Python3]
1 parent 5c94c03 commit 792bfb3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 removeElements(self, head, val):
9+
"""
10+
:type head: ListNode
11+
:type val: int
12+
:rtype: ListNode
13+
"""
14+
if head == None:
15+
return None
16+
head.next=self.removeElements(head.next,val)
17+
if head.val == val:
18+
return head.next
19+
else:
20+
return head

0 commit comments

Comments
 (0)