We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 565ce1f commit 6c5c9a9Copy full SHA for 6c5c9a9
Remove Duplicates from Sorted List/Remove_Duplicates_from_Sorted_List.py
@@ -0,0 +1,26 @@
1
+# 非常直接的解决方法
2
+# 60ms 52.08%
3
+
4
+# Definition for singly-linked list.
5
+# class ListNode:
6
+# def __init__(self, x):
7
+# self.val = x
8
+# self.next = None
9
10
+class Solution:
11
+ def deleteDuplicates(self, head):
12
+ """
13
+ :type head: ListNode
14
+ :rtype: ListNode
15
16
+ if not head:
17
+ return head
18
19
+ mid = head
20
21
+ while mid.next is not None:
22
+ if mid.val == mid.next.val:
23
+ mid.next = mid.next.next
24
+ else:
25
+ mid = mid.next
26
0 commit comments