We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 272820a commit 39b0afdCopy full SHA for 39b0afd
solution/083.Remove Duplicates from Sorted List/Solution.py
@@ -0,0 +1,29 @@
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 deleteDuplicates(self, head):
9
+ """
10
+ :type head: ListNode
11
+ :rtype: ListNode
12
13
+ if head == None:
14
+ return None
15
+ dict0=dict()
16
+ i=head
17
+ c=0
18
+ while i:
19
+ if i.val not in dict0.values():
20
+ dict0[c]=i.val
21
+ c+=1
22
+ i=i.next
23
+ new_listnode=ListNode(0)
24
+ j=new_listnode
25
+ for v in dict0.values():
26
+ new_listnode.next=ListNode(v)
27
+ new_listnode=new_listnode.next
28
+ return j.next
29
0 commit comments