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 5b91fcb commit 6a3c05aCopy full SHA for 6a3c05a
data_structure/linked_list.md
@@ -96,15 +96,13 @@ class Solution:
96
```Python
97
class Solution:
98
def deleteDuplicates(self, head: ListNode) -> ListNode:
99
- dummy = ListNode()
100
- dummy.next = head
+ dummy = ListNode(0, head)
101
pre = dummy
102
while head:
103
cur = head.val
104
if head.next and cur == head.next.val:
105
- while head.next and cur == head.next.val:
+ while head and cur == head.val:
106
head = head.next
107
- head = head.next
108
pre.next = head
109
else:
110
pre = head
0 commit comments